Precision and recall both depend on wherever you happen to draw the line between "predict positive" and "predict negative." What if you don't want to commit to one threshold at all — what if you want to know how good the model's ranking is, independent of where anyone eventually decides to cut it?
Drag the decision threshold. Every value traces out one point on the ROC curve — short for Receiver Operating Characteristic — the true-positive rate against the false-positive rate at that exact cutoff. Slide it all the way and you retrace the entire curve, one threshold at a time.
Sweep the threshold from down to , plotting at each stop:
- TPR — true-positive rate: the fraction of actual positives the model catches at this threshold; the same quantity as recall.
- FPR — false-positive rate: the fraction of actual negatives the model wrongly flags as positive at this threshold.
- , — true positives and false negatives at this threshold, the counts TPR is built from.
- , — false positives and true negatives at this threshold, the counts FPR is built from.
- Two extremes bound every curve
A model that separates classes perfectly traces a curve that shoots straight up to before moving right at all. A model no better than a coin flip traces the diagonal exactly. Every real model's curve falls somewhere between the two.
- AUC condenses the whole sweep into one number
The area under this curve (AUC) is the probability a random positive example gets a higher score than a random negative one — one number that summarizes the entire threshold sweep at once.
The curve bows up and to the left of the diagonal — better than chance, but not the sharp right angle a perfect separator would trace. That's exactly what the one overlapping score pair in this dataset should produce: mostly correct ranking, with one pair out of place.
Three positives (scores ) and three negatives (scores ):
- Two points at zero false positives
- At threshold : TPR, FPR.
- At threshold : TPR, FPR — both real positives outrank every negative so far.
- The one overlapping pair costs a false positive
- At threshold , the highest-scoring negative gets swept in too: TPR stays at , but FPR jumps to .
- One step later, at , the last positive is caught: TPR reaches , FPR still .
- Integrating the whole curve
AUC equals the fraction of (positive, negative) pairs where the positive scores higher — check all pairs:
- beats all three negatives (): wins
- beats all three negatives: wins
- beats and , but loses to : wins
Total: correctly-ranked pairs out of , so — meaningfully better than a coin flip's , but short of a perfect , exactly because of that one overlapping pair ( losing to ).
Drag the threshold until every positive is caught (TPR=1) with the fewest possible false alarms.
AUC answers a question accuracy, precision, and recall all dodge: how good is the model's ranking, before anyone commits to a specific cutoff? That makes it the right tool for comparing models that might eventually be deployed at different thresholds for different purposes — a fraud system tuned conservative in one country and aggressive in another can still be compared fairly by the same AUC, even though their accuracies at their own chosen thresholds would look completely different.