Classification · Case Study 03

Poisonous or Edible? A Mushroom Classifier

Edible or poisonous from 22 traits, where one kind of error is merely annoying and the other is fatal.

ClassificationReal UCI dataInterpretable
Live predictor + threshold demo + notebook
The question

Given 22 traits of a mushroom, is it edible or poisonous? A binary classification problem with a brutal twist: one kind of error is annoying, the other is fatal. That asymmetry is the whole point of the study.

The data

The classic UCI Mushroom dataset: 8,124 real mushrooms from a 1981 Audubon Society field guide, every trait categorical. Real cleaning calls too: a constant column that carries no information gets dropped, and 2,480 missing stalk-root values are kept as their own category rather than thrown away. Then every trait is one-hot encoded into 116 features.

The approach

Explore the data (odor alone nearly separates the classes), one-hot encode, then train a logistic regression and a decision tree with a proper train/test split, then judge them the right way: confusion matrix, precision, recall, ROC and AUC, and a tuned decision threshold, not a single accuracy number.

What it found

Both models scored above 99.8% on every metric, and made zero false positives. The catch: they still labeled 2 poisonous mushrooms as edible. Every mistake was the dangerous kind, which plain accuracy hid completely. Lowering the decision threshold drives those false negatives to zero. The tree also stayed readable: odor carries most of the signal, and its top rules read like a foraging heuristic. The real lesson transfers straight to fraud detection and disease screening: when one error is far more costly, accuracy is a trap and the confusion matrix is the truth.

99.9%
accuracy (both models)
2
poison missed at 0.50 cutoff
1.00
ROC AUC
8,124
mushrooms
Skills demonstrated
classificationone-hot encodingmissing-data strategylogistic regressiondecision treesconfusion matrixprecision / recallROC / AUCthreshold tuningcost-sensitive evaluationmodel interpretability