How to Read an ROC Curve and AUC Score

An ROC curve shows how a binary classifier trades off true positives against false positives as you move its decision threshold. This guide explains what each axis means, what a single point on the curve represents, how to read the AUC score, and how to pick a working threshold — with a small worked example you can check by hand and a short scikit-learn snippet.

Written by Projectech15 min readPublished
For B.E./B.Tech students evaluating a binary classifier who need to read ROC curves, interpret AUC scores and pick a working threshold. Topics: Python, scikit-learn, Machine Learning, ROC Curve, AUC Score
Illustration of an ROC curve bowing towards the top-left corner above the diagonal line of random guessing, with the area under the curve shaded.
Illustration generated for this guide.
In this guide

How to Read an ROC Curve and AUC Score

A single accuracy number rarely tells you whether a binary classifier is actually good. Two models can both score 85% accuracy while behaving very differently: one may catch nearly every positive case but cry wolf constantly, while the other rarely raises a false alarm but misses half the positives. The ROC curve makes that trade-off visible, and the AUC score compresses the whole curve into one number.

Quick Answer

An ROC curve plots the true positive rate (TPR) against the false positive rate (FPR) as the decision threshold sweeps from strict to lenient. Each point on the curve is one threshold. The AUC is the area under that curve: 0.5 means the model ranks positives and negatives no better than chance, 1.0 means perfect separation, and below 0.5 means the model is systematically wrong (or the labels are flipped). Use AUC to compare ranking quality, then pick your operating threshold from the curve itself, based on which error costs more in your application.

Why Accuracy Alone Is Not Enough

Consider a classifier that predicts whether a patient has a disease. If only 5 out of 100 patients actually have it, a model that always answers "no disease" scores 95% accuracy — and is completely useless. Accuracy hides the split between the two kinds of error: false negatives (a real positive the model missed) and false positives (a negative case the model flagged wrongly).

Which error matters more depends entirely on the application. Missing a disease is far worse than a false alarm that a follow-up test can clear. In a spam filter, the balance reverses: sending a genuine email to the spam folder is usually worse than letting one spam message through. The ROC curve exists to show you this trade-off across every possible threshold, instead of hiding it behind one accuracy figure computed at one threshold.

If you need a refresher on the four cells of the confusion matrix and what precision, recall and F1 mean at a single fixed threshold, read the companion guide on confusion matrices, precision, recall and F1 first — this guide picks up where that one stops and looks at what happens when the threshold moves.

What the ROC Curve Actually Plots

ROC stands for Receiver Operating Characteristic, a term borrowed from radar engineering. The curve has two axes:

  • Horizontal axis — False Positive Rate (FPR). Out of all the genuinely negative cases, what fraction did the model wrongly flag as positive? FPR = FP / (FP + TN). It runs from 0 (no false alarms) to 1 (every negative flagged).
  • Vertical axis — True Positive Rate (TPR). Out of all the genuinely positive cases, what fraction did the model catch? TPR = TP / (TP + FN). This is the same quantity as recall. It runs from 0 (nothing caught) to 1 (everything caught).

Both axes are rates, not raw counts. That is the key design choice: because each axis is divided by its own class total, the curve is not distorted by how many positives and negatives happen to be in the test set.

What one point on the curve means

Pick a threshold, say 0.5. Every test sample whose predicted probability is at or above 0.5 is labelled positive; everything below is labelled negative. Count the resulting TP, FP, TN and FN, compute TPR and FPR, and plot that one point. Now lower the threshold to 0.4 and repeat. More samples cross into the positive side, so TPR rises — but FPR rises too, because some negatives also cross. Each threshold gives one point; sweeping the threshold from 1.0 down to 0.0 traces out the full curve, from the bottom-left corner (0, 0) to the top-right corner (1, 1).

  • Bottom-left (0, 0): threshold so strict that nothing is called positive. No false alarms, but nothing caught either.
  • Top-right (1, 1): threshold so lenient that everything is called positive. Everything caught, but every negative flagged too.
  • Top-left (0, 1): the ideal — every positive caught, no false alarms. A real curve never quite reaches it.
  • The diagonal from (0, 0) to (1, 1): random guessing. A model that scores positives and negatives at random lands on this line, whatever threshold you pick.

The further the curve bows towards the top-left corner, the better the model separates the two classes.

Worked Example: Three Thresholds, One Test Set

The numbers below are a small teaching example, invented only so the arithmetic can be checked by hand. The test set has 100 samples: 40 genuinely positive and 60 genuinely negative. The same trained model is evaluated at three thresholds.

Threshold TP FN FP TN TPR = TP / 40 FPR = FP / 60
0.9 (strict) 12 28 2 58 12 / 40 = 0.30 2 / 60 = 0.03
0.5 (middle) 32 8 9 51 32 / 40 = 0.80 9 / 60 = 0.15
0.1 (lenient) 39 1 30 30 39 / 40 = 0.98 30 / 60 = 0.50

Check each row: TP + FN always equals 40, and FP + TN always equals 60.

Plotting the three points gives (0.03, 0.30), (0.15, 0.80) and (0.50, 0.98), plus the corners (0, 0) and (1, 1):

  • At 0.9, the model is cautious: only 3% of negatives are wrongly flagged, but it catches just 30% of positives. Seventy percent of real cases slip through.
  • At 0.5, it catches 80% of positives while wrongly flagging 15% of negatives. For many applications this is the sensible middle ground.
  • At 0.1, it catches 98% of positives — but half of all negatives are flagged too. If a false alarm triggers an expensive follow-up, this threshold is unusable.

Notice the trade-off is not one-for-one. Moving from 0.9 to 0.5 buys 50 percentage points of TPR for 12 points of FPR. Moving from 0.5 to 0.1 buys only 18 more points of TPR but costs 35 points of FPR. The curve is steep at first, then flattens — that flattening is where extra leniency stops paying off.

Estimating the AUC from these points

The AUC is the area under the curve. With just these points, the trapezium rule gives a rough estimate. The five points in order are (0, 0), (0.03, 0.30), (0.15, 0.80), (0.50, 0.98) and (1, 1). The four trapezium areas are approximately 0.005, 0.064, 0.311 and 0.494, which sum to about 0.87 — good ranking, well above chance, but far from perfect. A real AUC computed from every threshold on a larger test set would be more precise; this hand calculation only shows where the number comes from.

How to Read the AUC Score

The AUC has a useful plain-language meaning: it is the probability that the model ranks a randomly chosen positive sample higher than a randomly chosen negative sample. An AUC of 0.87 means that happens about 87% of the time.

Use these landmarks when interpreting a value:

  • AUC = 1.0 — perfect separation. Every positive scores above every negative. Treat this with suspicion on real data: it often means the label leaked into a feature, or the model was evaluated on its own training data.
  • AUC = 0.9 to 1.0 — excellent ranking. The curve hugs the top-left corner.
  • AUC = 0.8 to 0.9 — good ranking. Usable for most student and prototype applications, with a threshold chosen carefully.
  • AUC = 0.7 to 0.8 — fair. The model has real signal but makes frequent ranking errors.
  • AUC = 0.5 — no better than chance. The model cannot tell the classes apart.
  • AUC below 0.5 — worse than random. The model systematically ranks negatives above positives. In practice this usually means the labels are flipped somewhere in the pipeline — check the label encoding before assuming the model is useless. Inverting the predictions of a 0.3 AUC model gives a 0.7 AUC model.

Two practical notes. First, AUC is a ranking measure, not a calibration measure: it says nothing about whether a predicted probability of 0.8 really means an 80% chance. Second, small differences in AUC — say 0.86 versus 0.88 on a hundred-sample test set — are usually noise. Do not declare a winner on a gap that small without a larger test set.

How the Curve Is Built: The Threshold Sweep, Step by Step

If you want to reproduce the curve yourself rather than trusting a library, the procedure is straightforward:

  1. Collect predicted probabilities, not hard labels. Your model must output a score for each test sample — usually a probability between 0 and 1. A model that only outputs yes/no cannot produce an ROC curve.
  2. Sort the test samples by predicted score, highest first.
  3. Walk down the sorted list, treating each distinct score as a threshold. At each step, every sample above the line is predicted positive, everything below is predicted negative.
  4. At each threshold, count TP, FP, TN and FN and compute TPR and FPR.
  5. Plot the points in order and join them. The curve starts at (0, 0) and ends at (1, 1).

Choosing an Operating Threshold

A deployed model needs one threshold. Pick it from the curve, not from habit — 0.5 is only a default, and it is often the wrong one. Three approaches cover most student projects:

1. Youden's J statistic

Youden's J is TPR minus FPR, and the threshold that maximises it is the point on the curve furthest above the diagonal:

  • At 0.9: J = 0.30 − 0.03 = 0.27
  • At 0.5: J = 0.80 − 0.15 = 0.65
  • At 0.1: J = 0.98 − 0.50 = 0.48

The 0.5 threshold wins, with J = 0.65. Youden's J is a good starting point because it balances the two error types equally. But "equally" is exactly its limitation: it assumes a false positive and a false negative cost the same, which is rarely true.

2. Weight the errors by their real cost

Ask what each error actually costs in your application, then choose the point on the curve that minimises total cost:

  • Disease screening: a missed case can be serious, while a false alarm leads to a cheap re-test. Favour high TPR even at the cost of a higher FPR — a lenient threshold.
  • Spam filtering: a genuine email in the spam folder is a lost message, while a spam message in the inbox is a minor annoyance. Favour low FPR — a strict threshold.
  • Fraud flagging: a missed fraud costs money, a false flag costs a manual review. The balance depends on the review team's capacity and the transaction values.

If you can put numbers on the costs, compute the expected cost at each candidate threshold and pick the minimum. If you cannot, state the trade-off explicitly in your report instead of silently accepting 0.5.

3. Fix one rate, read off the other

Sometimes a requirement fixes one side. A screening tool might need to catch at least 95% of positives; find the point on the curve where TPR = 0.95 and read off the FPR you must accept. A notification system might tolerate at most a 5% false alarm rate; find FPR = 0.05 and read off the TPR you get. This is the most honest way to choose a threshold when a requirement has already set the constraint.

When AUC Is Useful — and When It Misleads

AUC is a good tool for comparing models on the same test set, especially during model selection: train three classifiers, compute each one's AUC on the same held-out data, and the ranking is usually meaningful. It is also useful because it summarises performance across all thresholds, so it does not depend on one lucky threshold choice.

But AUC has a well-known blind spot: heavy class imbalance. Imagine a fraud detector on 10,000 transactions with only 50 frauds. A model can reach a high AUC while still producing far more false alarms than true catches in absolute terms, because the FPR denominator (9,950 genuine transactions) is so large that even hundreds of false positives keep FPR small. The curve looks good; the user experience is a flood of false alarms.

In that situation, use the precision-recall curve alongside the ROC curve. Precision (of everything flagged positive, how much was truly positive) is sensitive to the absolute number of false positives, so it exposes the problem that ROC hides. A common rule of thumb:

  • Roughly balanced classes (say, 30–70% positives): ROC and AUC are fine on their own.
  • Strong imbalance (a few percent positives or fewer): report the precision-recall curve and average precision too, and check the confusion matrix at your chosen operating threshold.

Other situations where AUC misleads: comparing AUCs computed on different test sets (the test sets differ, so the numbers are not comparable) and quoting AUC when what the user actually needs is a decision at one threshold.

Computing ROC and AUC in Python with scikit-learn

The standard tool is scikit-learn. You need the true labels and the predicted probabilities for the positive class — predict_proba returns one column per class, and you want the column for class 1. The snippet below uses small illustrative numbers; in a real project, y_true and y_scores come from your held-out test set.

from sklearn.metrics import roc_curve, roc_auc_score

# y_true: 0 or 1 for each test sample; y_scores: predicted
# probability of class 1 from model.predict_proba(X)[:, 1]
y_true = [0, 1, 1, 0, 1, 0, 1, 0, 0, 1]
y_scores = [0.12, 0.88, 0.65, 0.30, 0.91, 0.45, 0.72, 0.20, 0.55, 0.81]

fpr, tpr, thresholds = roc_curve(y_true, y_scores)
auc = roc_auc_score(y_true, y_scores)
print("AUC:", round(auc, 3))
for f, t, th in zip(fpr, tpr, thresholds):
    print(f"threshold {th:.2f} -> FPR {f:.2f}, TPR {t:.2f}")

A few things to notice in the output. The thresholds array runs from high to low, and roc_curve returns one point per distinct score, so the curve can have many more points than the three in the hand example. The first threshold is above the highest score, giving the (0, 0) corner; the last is the lowest score, giving (1, 1). If you want the plot itself, pass fpr and tpr to matplotlib with the diagonal drawn in for reference — the diagonal is what turns a bare curve into a readable comparison against chance.

Common Mistakes When Reading ROC Curves

  • Reporting AUC alone. An AUC of 0.87 says nothing about what happens at the threshold you will actually deploy. Always report the operating threshold and the confusion matrix at that threshold alongside the AUC.
  • Evaluating on training data. A model that memorised its training set can show an AUC near 1.0 while performing poorly on new data. Always use held-out data.
  • Comparing AUCs across different test sets. An AUC of 0.85 on one test set and 0.82 on another proves nothing about the models — the test sets differ. Compare models on the same test set.
  • Treating 0.5 as a magic threshold. The default is a starting point, not a decision. Pick the threshold from the cost of errors in your application.
  • Using AUC as the only metric on imbalanced data. Pair it with the precision-recall curve and average precision whenever positives are rare.
  • Forgetting calibration. A high AUC does not mean the predicted probabilities are trustworthy as probabilities. If your application acts on the probability itself — a risk score shown to a user, for example — check calibration separately.
  • Reading a curve built from too few samples. With 20 test samples, the curve is a staircase with huge steps, and the AUC is noisy. Treat small-sample AUC values as rough indications, not precise measurements.
  • Assuming a higher AUC always means a better model for your use. Two curves can cross: model A can have a higher AUC overall while model B is better in the low-FPR region your application actually needs. If you operate in one region of the curve, compare the models there.

Frequently Asked Questions

What does the ROC curve tell me that accuracy does not?

Accuracy collapses everything into one number at one threshold, and it can be dominated by the majority class. The ROC curve shows the full trade-off between catching positives and raising false alarms across every threshold, so you can see whether a model genuinely separates the classes or just exploits the class balance.

What is a good AUC score?

As a rough guide: 0.9 and above is excellent, 0.8 to 0.9 is good, 0.7 to 0.8 is fair, and 0.5 is chance. But "good" depends on the problem — some tasks are inherently hard and a 0.75 AUC is a solid result, while on an easy task 0.9 might be unimpressive. Compare against a simple baseline on the same test set rather than judging the number in isolation.

Can the AUC be below 0.5?

Yes. An AUC below 0.5 means the model ranks negatives above positives more often than chance — it is systematically wrong. Before discarding the model, check for flipped labels or an inverted score (for example, using the probability of class 0 instead of class 1). Inverting the predictions turns an AUC of 0.3 into 0.7.

How do I choose the best threshold from the ROC curve?

Start with Youden's J (the point furthest above the diagonal), then adjust for the real costs: move towards a lenient threshold if false negatives are expensive, or towards a strict one if false positives are. If a requirement fixes one rate — catch at least 95% of positives, or keep false alarms under 5% — find that point on the curve and take the threshold there.

Should I use ROC-AUC or precision-recall when my classes are imbalanced?

Use both, but trust precision-recall more when positives are rare. ROC-AUC can look impressive while the model still produces far more false alarms than true detections, because the FPR denominator is huge. The precision-recall curve exposes that directly, since precision counts false positives against true positives.

Why does my ROC curve look like a staircase?

Because the test set is small or the model outputs few distinct scores. Each step is one sample crossing the threshold. With hundreds of samples and continuous predicted probabilities, the curve smooths out.

Limitations

  • The worked example uses a 100-sample test set and three thresholds so the arithmetic can be checked by hand. A real evaluation needs a larger test set and the full curve.
  • AUC measures ranking quality only. It says nothing about probability calibration, and it does not tell you which threshold to deploy — that choice needs the costs of the two error types.
  • The landmarks for "good" AUC values (0.7, 0.8, 0.9) are rough conventions, not thresholds from a study. What counts as good depends on the task, the data and the baseline.
  • On heavily imbalanced data, a high AUC can hide a poor precision-recall trade-off. Pair ROC analysis with the precision-recall curve in that case.
  • The Python snippet uses a tiny ten-sample illustration. Real code should run on a held-out test set, and the AUC should be reported with the test-set size so readers can judge how much to trust it.

Need Help With Your Classifier Project?

If you are building a classifier and need help choosing the model, tuning the threshold or writing up the evaluation properly, message Projectech on WhatsApp at wa.me/918275719193 with your project idea, your branch and your deadline. You will get a reply with a quotation stating the scope, price and delivery timeline.