The ROC curve and its summary number, AUC, answer a question the other classification metrics cannot: how good is my model across every possible threshold, not just one? Precision, recall and F1 are all computed at a single decision threshold. ROC-AUC steps back and evaluates the model’s ranking ability as a whole.

The threshold problem
A classifier usually outputs a probability, which you turn into a class by comparing it to a threshold (commonly 0.5). But that choice is arbitrary — and, as the precision–recall trade-off shows, moving the threshold changes every metric. The ROC curve sidesteps the problem by plotting performance at all thresholds at once.
What the ROC curve plots
ROC stands for Receiver Operating Characteristic. The curve plots two rates, both taken from the confusion matrix as the threshold sweeps from 1 down to 0:
Each point on the curve corresponds to one threshold. As you lower the threshold, both TPR and FPR rise; the shape of that climb describes how well the model separates the two classes.
Reading the ROC curve
- A curve that hugs the top-left corner is excellent — high true positive rate with a low false positive rate.
- The diagonal line (bottom-left to top-right) represents random guessing.
- A curve below the diagonal is worse than random — usually a sign your labels or probabilities are inverted.
What is AUC?
AUC is the Area Under the ROC Curve — a single number from 0 to 1 that summarises the whole curve:
AUC has an elegant interpretation: it is the probability that the model ranks a randomly chosen positive example higher than a randomly chosen negative one. An AUC of 0.9 means that 90% of the time, a true positive gets a higher score than a true negative. Because it measures ranking, AUC is threshold-independent — reading the AUC alongside the shape of the ROC curve tells you both how well the model ranks and where it separates classes. See the Wikipedia ROC curve article for the formal treatment.
Why the ROC curve is popular
The ROC curve earns its place in almost every binary-classification report for three reasons:
- Threshold-free — compare models before committing to an operating point.
- Single, interpretable number — easy to report and rank models by.
- Scale-invariant — depends on the ranking of predictions, not their absolute values.
Computing ROC-AUC in Python
from sklearn.metrics import roc_auc_score, roc_curve
y_true = [0, 0, 1, 1]
y_score = [0.1, 0.4, 0.35, 0.8] # predicted probabilities
print("AUC:", roc_auc_score(y_true, y_score))
fpr, tpr, thresholds = roc_curve(y_true, y_score)roc_auc_score takes predicted probabilities or scores, not hard 0/1 labels — the ranking is the whole point.Frequently asked questions
What is a good AUC score?
What is the difference between ROC-AUC and F1?
Should I use ROC-AUC or PR-AUC?
Related guides
- Confusion Matrix — where TPR and FPR come from.
- Precision vs Recall — the threshold trade-off.
- F1 Score — the threshold-specific complement.
- Classification Metrics — which metric to use and when.