Edible or Not?
An exploratory dashboard and Random Forest model that ask, “Can I determine whether a mushroom will be edible based on its features?”
Skills Exercised
Languages
- Python
Frameworks & Tools
- Dash
- Plotly
- pandas
- scikit-learn
- SciPy
- Seaborn
- Matplotlib
Concepts
- Chi-Square & Cramer’s V
- One-Hot Encoding
- Random Forests
- Cross-Validation
- Data Visualization
Overview
This project explores the UCI Mushroom Classification dataset, 8,124 mushrooms described by categorical features such as odor, gill color, and spore print color, to answer one question: can a mushroom’s edibility be determined from its features? It ranks every feature by how strongly it is associated with edibility, breaks each one down interactively, and then trains a model to make the prediction. Odor turns out to be an almost perfect indicator on its own, and the Random Forest confirms it as the most important feature.
The analysis runs in Python. pandas expands the dataset’s single-letter codes into readable values, and SciPy’s chi-square test feeds a bias-corrected Cramer’s V for each feature. The strongest feature is selected programmatically for a Seaborn count heatmap, and a Plotly chart with a dropdown shows the edible/poisonous split for any feature. For the model, the features are one-hot encoded and split 80/20 with stratification. A scikit-learn Random Forest is trained on the result and checked with five-fold cross-validation. Its feature importance, confusion matrix, per-class metrics, and precision-recall curve are all presented in a single-page Dash app.


