All labs
Accuracy Is a Trap: Metrics Under Class Imbalance
Move a threshold, move the prevalence, and watch which performance numbers stay honest and which quietly lie.
Ch 5 5.6
Comparator
Supervised Learning
20 mindifficulty 2/5Controls
2.0%
Share of positives in the population.
1.600
How far apart the two latent score distributions sit.
0.500
Changes the confusion matrix only — not the ranking.
2000
Random seed
Every result on this page is a deterministic function of the seed and the controls.
Score distributions by true class
The threshold is a vertical cut.
NegativesPositives
ROC
AUC = 0.936 — threshold-free.
Precision–recall
Average precision = 0.520 — baseline 0.021.
Confusion matrix at the current threshold
Pred +
Pred −
True +
5
37
True −
1
1957
Accuracy
98.10%
always-negative: 97.90%
Balanced accuracy
55.93%
Sensitivity / recall
11.90%
Specificity
99.95%
Precision (PPV)
83.33%
depends on prevalence
F1
0.208
MCC
0.311
robust to imbalance
AUC
0.936
independent of threshold
