Skip to content

KunalThakur204/mushroom-classification-ml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ„โœจ Mushroom Classification Using Machine Learning An Animated-Style ML Prototype that Predicts Whatโ€™s Poisonousโ€ฆ Before Nature Does.

This project transforms a biological safety problem into a clean, modern AI system โ€” a system that quietly scans mushrooms and whispers: โ€œYeh khane layak hai ya khatra?โ€ ๐Ÿ„โš ๏ธ

Designed with smooth ML flow, animated thinking, and safety as its backbone.

๐ŸŒฑ 1. About the Project

Based on UCIโ€™s 8,124-sample Mushroom Dataset, this ML model classifies mushrooms as:

โœ… Edible (E) โŒ Poisonous (P)

Traditional identification depends on experts and countless risks. Yeh model un sabko replace nahi karta, par unka kaam aasaan zaroor banata hai.

๐ŸŽฏ 2. Objectives

Analyze mushroom dataset & discover patterns

Encode 22 categorical features

Train multiple models (RF, SVM, DT, LR, NB, KNN)

Compare accuracy, ROC-AUC and confusion matrix

Identify the most dangerous attributes like odor, gill-size, spore print color

Build a fully interpretable ML pipeline

๐Ÿ› ๏ธ 3. Requirements Software

Windows 10/11 or Ubuntu

Python 3.10+

Jupyter / VS Code / Google Colab

Libraries

Pandas

NumPy

Scikit-learn

Matplotlib

Seaborn

Dataset

UCI Mushroom Dataset 22 categorical attributes + 1 target class (edible/poisonous)

๐Ÿงช 4. Implementation (Animated ML Workflow) [Data Loading] ---> [Label Encoding] ---> [Train-Test Split] โ†“ โ†“ โ†“ DataFrame Peek Categorical Fix 80% Train | 20% Test โ†“ โ†“ โ†“

            [Model Training: RF, SVM, DT, KNN]

     โ†“
 [Accuracy + Confusion Matrix + ROC-AUC]
     โ†“

[Feature Importance Visualization]

โœ… Code Snippets (Short & Clean) Step 1 โ€” Load Dataset data = pd.read_csv("mushrooms.csv")

Step 2 โ€” Encode Features from sklearn.preprocessing import LabelEncoder le = LabelEncoder() for col in data.columns: data[col] = le.fit_transform(data[col])

Step 3 โ€” Prepare Data X = data.drop('class', axis=1) y = data['class']

X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.2, random_state=42 )

Step 4 โ€” Train Random Forest model = RandomForestClassifier(random_state=42) model.fit(X_train, y_train)

Step 5 โ€” Evaluate y_pred = model.predict(X_test) accuracy_score(y_test, y_pred) roc_auc_score(y_test, y_pred)

Step 6 โ€” Feature Importance sns.barplot(x=model.feature_importances_, y=X.columns)

๐Ÿ“Š 5. Output Summary โœ… Accuracy: 92% โœ… Best Models: Random Forest & SVM โœ… Top Features:

Odor

Gill-Size

Spore-Print-Color

Cap-Surface

โœ… Confusion Matrix:

Minimal confusion between edible and poisonous groups.

โœ… ROC-AUC:

High โ€” strong classification capability.

๐ŸŒŸ 6. Learning Outcomes

Hands-on experience with ML classification algorithms

Encoding categorical biological attributes

Understanding confusion matrix & ROC-AUC

Discovering which mushroom traits affect toxicity

Complete end-to-end ML workflow understanding

Realizing MLโ€™s potential in biological & ecological safety

๐Ÿ”ฎ 7. Future Enhancements

Deep learning classification (CNN on mushroom images)

Mobile app for real-time identification

Explainable AI (SHAP Values)

Advanced feature selection

Deployment via Flask / FastAPI

๐Ÿ™ Credits

Developed with care, curiosity, and responsibility โ€” because biology me galti ki gunjฤish nahi hoti.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published