Start studying
Module 1 · Machine Learning Module contents
Module 1  ·  Card 47 / 55intermediate

ROC-AUC

The ROC curve plots true positive rate against false positive rate across every threshold.

AUC is the area underneath that curve.

1.0 is a perfect model and 0.5 is random guessing.

It measures ranking quality, independent of any one threshold.

It can look flatteringly high when the negative class hugely outnumbers the positive one.

Learn in depth ↓
Module 01 · Machine Learning · 55 concepts
In depth  /  15 lines

ROC-AUC, in more detail

ROC-AUC does not care about your threshold at all.

It asks a simpler question: does the model rank cases in the right order?

Take one real positive and one real negative at random.

AUC is the chance the model gave the positive one the higher score.

A perfect ranker gets 1.0 and random guessing gets 0.5.

Below 0.5 means it is ranking backwards, which is worth investigating.

Being threshold-free, it compares models fairly before you have tuned anything.

Its weakness shows when negatives vastly outnumber positives.

The false positive rate barely moves when the denominator is enormous.

So a model can look strong at 0.95 while being useless in practice.

Fraud detection is the classic case where exactly this happens.

It also treats the two kinds of mistake as equally important.

It says nothing about whether the probabilities themselves are sensible.

A model can rank perfectly and still be wildly overconfident.

For rare positives use PR-AUC, and keep ROC-AUC as the secondary number.

Want the full technical article? Wikipedia ↗
Deep dive

What is underneath ROC-AUC

The two rates the curve is made of

TPR=TPTP+FNFPR=FPFP+TNTPR = \frac{TP}{TP + FN} \qquad FPR = \frac{FP}{FP + TN}
  • TPRTPR: the true positive rate, which is recall: the fraction of real positives caught.
  • FPRFPR: the false positive rate: the fraction of real negatives wrongly flagged.

Sweep the threshold from high to low, plot TPRTPR against FPRFPR at every value, and that path is the ROC curve.

The area underneath it is the AUC, a single number between 0 and 1.

What the number actually means

The area has an exact probabilistic reading, and it is far more useful than "area under a curve".

AUC=P(s(x+)>s(x−))\mathrm{AUC} = P\big( s(x^{+}) > s(x^{-}) \big)
  • s(x+)s(x^{+}): the model's score on a randomly chosen positive example.
  • s(x−)s(x^{-}): its score on a randomly chosen negative one.

AUC is the probability that the model ranks a random positive above a random negative.

So 0.5 is a coin toss, 1.0 is a perfect ranking, and 0.5 is the floor rather than 0: a model scoring 0.2 is a good model with its sign flipped.

Threshold-free, which is the point and the limitation

AUC=∫01TPR d(FPR)\mathrm{AUC} = \int_0^1 TPR \, d(FPR)

Because it integrates over every threshold, AUC measures the quality of the ranking rather than of any particular decision.

That makes it the right metric when you have not chosen an operating point yet, and the wrong one when you have.

It also says nothing about calibration: a model can rank perfectly and still output probabilities that are all wrong.

Where it misleads

FPRFPR has TNTN in its denominator, and under heavy imbalance TNTN is enormous.

With 1000 negatives, going from 10 false positives to 50 moves FPRFPR from 0.01 to 0.05, which is barely visible on the plot.

But precision may have collapsed from 0.5 to 0.17 over the same move, because precision divides by the false positives directly.

That is why PR-AUC is the honest curve when positives are rare, and ROC-AUC flatters models on imbalanced data.

Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
What does an AUC of 0.5 tell you?
Machine Learning

55 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close