Evaluate an imbalanced classifier beyond accuracy
8 steps · about 4 h 5 min · Intermediate
- Choose metrics from the decision goal (guide, scikit-learn developers, 40 min)
Accuracy can look strong while a rare but important class is almost always missed.
- Count each kind of classification result (reference, scikit-learn developers, 20 min)
The confusion matrix connects abstract metrics to concrete false positives and false negatives.
- Trace precision-recall tradeoffs (reference, scikit-learn developers, 25 min)
A curve shows how changing the threshold shifts performance on the positive class.
- Plot average precision and the curve (guide, scikit-learn developers, 35 min)
Build the visual evaluation and relate its area to ranked predictions.
- Check whether probabilities mean what they say (guide, scikit-learn developers, 35 min)
Threshold decisions are more defensible when predicted probabilities are calibrated.
- Compare reliability curves (guide, scikit-learn developers, 35 min)
Visualise overconfidence and underconfidence across probability ranges.
- Tune the decision threshold separately (guide, scikit-learn developers, 30 min)
Probability estimation and the action cutoff are two different choices.
- Preserve class representation in validation (guide, scikit-learn developers, 25 min)
Stratification reduces fold failures while still requiring honest reporting of uncertainty.