esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

ROC-AUC vs PR-AUC

What ROC-AUC and PR-AUC measure, why PR-AUC is safer when positives are rare, and which one to report, explained simply for your AI interview.

In short

ROC-AUC scores how well a model ranks positives above negatives across every threshold, but with rare positives a few false alarms at the top can hide behind a high score. PR-AUC scores the precision and recall trade-off instead, so it is the safer guide when positives are rare.

11 min readIntermediateCommon · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

ROC-AUC and PR-AUC both grade how well a model ranks its scores across every cut-off. ROC-AUC looks at catches and false alarms, so with rare fraud it can look high even when many of the top alerts are wrong. PR-AUC looks at precision and recall, so it shows that problem. I would report PR-AUC first, check the precision of the top alerts, and use ROC-AUC when the two classes are roughly even.

What are ROC-AUC and PR-AUC, in plain words?

A classifier gives each payment a score. You pick a threshold, a cut-off score above which a payment is flagged as fraud. Move the cut-off up or down and you catch more fraud, but you also block more honest customers. A curve shows that trade-off at every cut-off. The AUC is the area under that curve, a single number from 0 to 1.

ROC-AUC uses the ROC curve, which plots the share of fraud you catch against the share of honest payments you wrongly flag. PR-AUC uses the precision-recall curve, which plots how many of your flags are right against how much fraud you catch. Both grade the same ranking, but they weigh the mistakes differently.

Think of a hospital triage nurse sorting a waiting room by how urgent each patient looks. The ranking is what she produces, and the hospital decides later where to draw the line. A fraud model works the same way: it ranks payments, and the bank picks the cut-off.

Key words

Threshold
The score above which a payment is flagged. Moving it trades catches against false alarms.
ROC curve
A plot of the true positive rate against the false positive rate at every threshold.
PR curve
A plot of precision against recall at every threshold.
Area under the curve (AUC)
The area under a curve, from 0 to 1. Higher means the ranking is better.
Precision and recall
Precision is how many flags are right. Recall is how much of the fraud you catch.

How do the two curves differ?

  • ROC

    Two rates

    Catch rate (true positive rate) on one axis, and false alarm rate (false positive rate) on the other.

  • PR

    Two qualities of the flags

    Precision, how many flags are right, against recall, how much of the fraud you catch.

The false alarm rate divides your false alarms by all the honest payments. With 990 honest payments, three false alarms are about 0.3 percent of them, a number that looks tiny. Precision and recall never use the honest payments that were correctly left alone, so PR-AUC does not get that cushion.

  • “The area under the ROC curve (AUC) represents the probability that the model, if given a randomly chosen positive and negative example, will rank the positive higher than the negative.”

    Google Machine Learning Crash Course

  • “AP summarizes a precision-recall curve as the weighted mean of precisions achieved at each threshold, with the increase in recall from the previous threshold used as the weight”

    scikit-learn

Why can ROC-AUC look good on rare fraud?

Take 1,000 card payments, 10 of them fraud. Two made-up models score them. Model A ranks most fraud high, but three honest payments score above every fraud. Model B ranks its fraud near the top, except one fraud that slips well down the list.

Rare fraud: two curves, two winners

Fraud model

scores each of 1,000 payments

Each curve reads the list

ROC-AUC

false alarms out of 990 honest

PR-AUC

weighs top-of-list errors most

Each one picks a winner

Model A (ROC says best)

3 false alarms at the top

Model B (PR says best)

fraud found near the top

  1. 1ROC-AUC reads every payment score.
  2. 2PR-AUC reads the same scores, top of the list first.
  3. 3Model A's three false alarms barely dent ROC-AUC, so it scores 0.997.
  4. 4Model B's fraud sits near the top, so PR-AUC scores it 0.901.
Same scores, two judges. ROC-AUC divides three false alarms by 990 honest payments and still scores Model A high. PR-AUC looks at the top of the list, where those false alarms sit, and picks Model B.

Here is the script. It builds both models and prints both scores.

Python
# A fraud model on 1,000 card payments, 10 of them fraud (made-up numbers).
import random
labels = [1] * 10 + [0] * 990
def roc_auc(scores, labels):
    # Chance a random fraud scores above a random genuine payment.
    pos = [s for s, y in zip(scores, labels) if y]
    neg = [s for s, y in zip(scores, labels) if not y]
    wins = sum((p > n) + 0.5 * (p == n) for p in pos for n in neg)
    return wins / (len(pos) * len(neg))
def pr_auc(scores, labels):
    # Average precision: walk down the ranked list, precision at each fraud found.
    tp, ap = 0, 0.0
    for k, (_, y) in enumerate(sorted(zip(scores, labels), reverse=True), 1):
        if y:
            tp += 1
            ap += tp / k
    return ap / sum(labels)
rng = random.Random(7)
fraud = [0.4 + 0.6 * rng.random() for _ in range(10)]
genuine = [0.3 * rng.random() for _ in range(990)]
# Model A: three genuine payments score above every fraud (false alarms at the top).
a_genuine = [1.5, 1.4, 1.3] + genuine[3:]
# Model B: one fraud slips to a low score, under most genuine payments.
b_fraud = fraud[:-1] + [0.05]
for name, f, g in [("Model A", fraud, a_genuine), ("Model B", b_fraud, genuine)]:
    scores = f + g
    print(f"{name}: ROC-AUC {roc_auc(scores, labels):.3f}, PR-AUC {pr_auc(scores, labels):.3f}")

Output

Model A: ROC-AUC 0.997, PR-AUC 0.596
Model B: ROC-AUC 0.918, PR-AUC 0.901

ROC-AUC says Model A is best, at 0.997 against 0.918. PR-AUC says Model B is best, at 0.901 against 0.596. The top of the list is where a fraud team looks, so PR-AUC fits the job. These are made-up numbers from a small script, not a benchmark result.

PR-AUC here is average precision. scikit-learn adds up the precision at each step down the ranked list, weighted by how much recall that step adds. It warns that another method, the trapezoidal rule, joins the points with straight lines, and that this can be too optimistic.

Which one should you report?

  1. 1

    Count the positives first

    If fraud, or any rare event, is a small slice of the data, lead with PR-AUC.

  2. 2

    Use ROC-AUC for even classes

    When the classes are roughly balanced, ROC-AUC is a fair summary and easy to compare across models.

  3. 3

    Look at the top of the list

    Ask how many of the first 50 alerts are real. That is the number the fraud team lives with.

  4. 4

    Name a cut-off

    Pick the threshold that matches the cost of a false alarm, then report precision and recall at that point.

  • “AUC and ROC work well for comparing models when the dataset is roughly balanced between classes.”

    Google Machine Learning Crash Course

  • “When the dataset is imbalanced, precision-recall curves (PRCs) and the area under those curves may offer a better comparative visualization of model performance.”

    Google Machine Learning Crash Course

Tip

Report both numbers and say which one drove the choice. If someone shows you only ROC-AUC for a one-in-a-hundred problem, ask for the precision of the top alerts.

How would you explain a high ROC-AUC to a fraud team?

The fraud lead says the new model has a ROC-AUC of 0.99 and wants it switched on for every payment tonight. Fraud is about one payment in a hundred.

  • Better

    Ask for the top alerts

    Check how many of the top 100 flags are real fraud before anything goes live, and report PR-AUC beside ROC-AUC.

  • Weaker

    Argue about the ROC number

    A high ROC-AUC does not show that the flags a human will actually review are good.

What does the interviewer want to hear?

A strong answer covers

  • Both are areas under a curve that grade one ranking across every cut-off.
  • ROC plots catch rate against false alarm rate. PR plots precision against recall.
  • ROC-AUC can look high on rare positives, because false alarms are divided by many honest cases.
  • On rare positives, PR-AUC is the safer report.
  • A named cut-off, since an AUC alone does not make the live decision.
  • Say which metric drove the choice, and why.

Common traps

  • Trap"ROC-AUC is always the best metric."

    BetterIt is a fair summary when the classes are balanced. With rare fraud, look at PR-AUC too.

  • Trap"A higher ROC-AUC always means a better model."

    BetterOnly for the ranking across all cut-offs. The team may act only on the top of the list.

  • Trap"PR-AUC is just accuracy on the positive class."

    BetterNo. It is built from precision and recall at every cut-off, so it measures the ranking.

Can you spot the weak report?

Spot the gap

A team reports ROC-AUC 0.98 on a fraud set where 0.5 percent of payments are fraud, and says the model is ready. What check is missing?

Quick check

A fraud model has 1 fraud in every 200 payments. Which metric should the team lead with?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q420Precision, recall and F1?10 min
  2. Q425How do you handle class imbalance?12 min
  3. Q419MSE vs cross-entropy loss?11 min
  4. Q422Train/validation/test splits?11 min
  5. Q423What is cross-validation?13 min
  6. Q424What is data leakage?11 min

Learn it in depth

Last updated on 27 November 2026

Building a model where the rare cases matter most?

I design and build AI products and agents, the UI and the system behind it. Book a short call and tell me what you need.