Skip to content
ML Visualization

ROC Curves & AUC

Data Prep & Model EvaluationIntermediate~7 min

ROC Curves & AUCVisualize the full threshold tradeoff in one curve.

The ROC curve traces how true-positive and false-positive rates trade off across every possible threshold. The area under it (AUC) summarizes the classifier’s ranking quality in a single number.

01
0.60
0.50

Pull the two score histograms apart with separability and the ROC morphs from the useless diagonal (AUC 0.5) toward the perfect corner (AUC 1.0). The threshold slides the operating point along the curve.

The idea in plain words

The ROC curve traces how the true-positive and false-positive rates trade off across everythreshold. The area under it (AUC) summarizes ranking quality in a single number: 1.0 is perfect, 0.5 is a coin flip.

Pull the two score distributions apart and the ROC morphs from the useless diagonal to the perfect corner. It complements precision–recall, though on heavily imbalanced data a high AUC can still hide poor precision.

Now, the math

The ROC plots the true-positive rate against the false-positive rate:

TPR=TPTP+FN,FPR=FPFP+TN\text{TPR} = \frac{TP}{TP+FN},\qquad \text{FPR} = \frac{FP}{FP+TN}
TPR\text{TPR}
recall — the vertical axis of the ROC.
FPR\text{FPR}
false-alarm rate — the horizontal axis.
AUC\text{AUC}
area under the curve — probability a random positive outranks a random negative.
Show the derivation

Sweeping the threshold from high to low traces the curve from the origin to (1,1). AUC equals the probability that a randomly chosen positive scores higher than a randomly chosen negative, so it measures the model’s ranking independent of any single threshold.

Now Break It

Try this: On imbalanced data AUC looks great while precision at the useful threshold is terrible.

Control: Class balance slider (set imbalanced)

Last updated .