Back to Classic ML Mind Map
中文·English
📊 Classic MLID: roc-auc

ROC-AUC

🎯Core Definition
sweeping every classification threshold, plot the true positive rate TPR=TPTP+FNTPR = \frac{TP}{TP+FN} (= recall) on the y-axis against the false positive rate FPR=FPFP+TNFPR = \frac{FP}{FP+TN} (= 1 - specificity) on the x-axis; AUC is the area under this curve. As the threshold drops, TPR rises monotonically while FPR grows too; key points: (0,0) = predict all negative, (1,1) = predict all positive, and the diagonal TPR=FPRTPR = FPR is random guessing (AUC = 0.5). Probabilistic interpretation: AUC = the probability that a randomly chosen positive scores higher than a randomly chosen negative, AUC=P(s+>s)AUC = P(s_{+} > s_{-}) — threshold-free and class-ratio-free, a pure ranking metric. Hand computation: 4 samples with scores [0.9, 0.7, 0.5, 0.3] and labels [+, -, +, -]: there are 2×2=42 \times 2 = 4 positive–negative pairs, and 3 of them (0.9, 0.7), (0.9, 0.3), (0.5, 0.3) are correctly ordered while only (0.5, 0.7) is inverted, so AUC=3/4=0.75AUC = 3/4 = 0.75.
💡Use Cases
binary classification and ranking-quality evaluation (credit, recsys, search); interview staple “how is AUC computed and interpreted”; also used for model selection and tuning since it needs no fixed threshold.
Key Problems Solved
accuracy and PR require a chosen threshold to compare models, while AUC decouples ranking quality from the threshold — one number summarizing all thresholds; however, under extreme imbalance the FPR denominator FP+TNFP+TN is inflated by the huge negative population, so a few false positives barely move FPR and the ROC curve looks over-optimistic — switch to the PR curve (sensitive to the P=ρP = \rho baseline, exposing models whose ranking is polluted by negatives); AUC is class-ratio insensitive because it is rank-based, and it does not tell you the operating point — pair it with the threshold curve to pick TPR/FPR.
🎯5 High-Frequency Exam Points
1
Hand-compute AUC: 4 samples with scores [0.9, 0.7, 0.5, 0.3] and labels [+, -, +, -], counting positive–negative pairs.
2
What is the probabilistic interpretation of AUC? Why is random guessing AUC ≈ 0.5 and a perfect ranking AUC = 1?
3
How to draw the ROC curve from model scores (threshold sweep updating TPR/FPR each step)? How is AUC computed by the trapezoid rule?
4
Why prefer the PR curve over ROC under extreme class imbalance, and why is AUC insensitive to the class ratio?
5
How to pick an operating threshold for a model with AUC = 0.75? Why doesn't AUC directly give a TPR/FPR working point?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "ROC-AUC"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardPrecision, Recall & F1Next CardNDCG

🔗 More Classic ML Knowledge Cards

AdaBoost DerivationBagging & Random ForestBaum-Welch (HMM EM)GBDT Negative Gradient