download

Two models have the same AUC. Which probabilities do you trust?

Machine learning~12 minReviewed 29 Oct 2026Free · No sign-in

Question

A shop predicts whether each of 8 users will buy after a promo email. The labels are [0, 0, 0, 1, 0, 1, 1, 1], where 1 means the user bought.

  • Model A gives the first four users 0.2 and the last four 0.8.
  • Model B gives them 0.01 and 0.99.

Both models rank the users the same way, so both have ROC AUC 0.75. Marketing will read the numbers as chances to plan a budget.

Which model's probabilities would you trust? How would you measure it?

Show hints (3)
  1. "SAME ORDER"

    AUC only looks at the order of the scores. B says 0.99 for the last four users. How many of them really bought?

  2. "COUNT EACH GROUP"

    In the first four, 1 user bought. In the last four, 3 bought. Whose numbers are closer to 0.25 and 0.75?

  3. "SCORE THE NUMBERS"

    Log loss is the mean of −ln(p given to what really happened). A buyer that B gave 0.01 costs −ln(0.01) = 4.6.

Show checked explanation

Trust A. AUC checks only the order, and the order is the same. A's 0.2 and 0.8 are close to what happened: 1 of 4 and 3 of 4 bought. B is overconfident. Log loss (0.570 vs 1.159) and the Brier score (0.190 vs 0.245) both prefer A. Then check calibration on more data.

"SOLUTION · PYTHON"
from sklearn.metrics import brier_score_loss, log_loss, roc_auc_score

y = [0, 0, 0, 1, 0, 1, 1, 1]  # 1 = bought after the email
models = {"A": [0.2] * 4 + [0.8] * 4, "B": [0.01] * 4 + [0.99] * 4}

for name, p in models.items():
    print(f"{name}: AUC={roc_auc_score(y, p):.2f} "
          f"log loss={log_loss(y, p):.3f} "
          f"Brier={brier_score_loss(y, p):.3f}")
"OUTPUT"
A: AUC=0.75 log loss=0.570 Brier=0.190
B: AUC=0.75 log loss=1.159 Brier=0.245

Code run on CPython 3.12 with scikit-learn 1.9 against the examples above. Checked by an editor other than the author.

Walkthrough

ROC AUC only asks whether a buyer scores above a non-buyer. Both models give the same answer for every pair, so both get 0.75.

Marketing reads the numbers themselves. If 1,000 users get 0.8, they expect about 800 buyers. That holds only for a calibrated model: among users given about p, about a share p really buy. Here is each group:

groupshare who boughtA saysB says
first 41 of 4 = 0.250.20.01
last 43 of 4 = 0.750.80.99

A is close in both groups. B promises near certainty and is wrong once in each group.

Two scores judge the probabilities themselves. Lower is better for both.

  • Log loss is the mean of −ln(p given to what really happened). For A, a right row costs −ln(0.8) = 0.223 and a wrong row −ln(0.2) = 1.609. Two of the eight rows are wrong: (6 × 0.223 + 2 × 1.609) / 8 = 0.570. For B, a wrong row costs −ln(0.01) = 4.605, and the mean is 1.159.
  • Brier score is the mean of (p − y)². For A: (6 × 0.04 + 2 × 0.64) / 8 = 0.190. For B: (6 × 0.0001 + 2 × 0.9801) / 8 = 0.245.

Log loss punishes confident mistakes much harder. B's two wrong rows make up 99% of its log loss.

On real data, bin the predictions (0 to 0.1, 0.1 to 0.2, and so on) and compare each bin's mean prediction with its share of buyers. sklearn.calibration.calibration_curve does this. You need hundreds of rows per bin.

If B ranks well but its numbers are off, keep it and fit a calibrator on held-out data: Platt scaling (a sigmoid on the score) or isotonic regression. CalibratedClassifierCV does either.

Common mistakes

  • Reading 0.8 as "80% chance" for any model. That holds only for a calibrated model. A model trained with class weights or oversampling, for example, scores the rare class well above its real rate.
  • Expecting log_loss to be infinite when a model says 0 for an event that happens. In the formula it is. scikit-learn clips probabilities to [eps, 1 − eps], so that row costs about 36.04.
  • Fitting the calibrator on the same rows you then score. The result looks better calibrated than it is. Use a separate validation set or cross-validation.

Follow-up questions

  • "Does calibration change the AUC?" Not with Platt scaling on one model: a sigmoid with a positive slope keeps the order, so AUC stays. Isotonic regression never swaps two scores, but it maps whole ranges of scores to one value. Those ties can move AUC a little, up or down.
  • "Is confidence bad, then?" No. With labels [0, 0, 0, 0, 1, 1, 1, 1], every row agrees with both models. B wins: log loss 0.010 against A's 0.223, Brier 0.0001 against 0.040. Confidence is good when the outcomes back it up.

What a strong answer covers

Separates ranking from probability quality: same AUC, different log loss and Brier. Checks calibration per bin, knows 0.8 means 80% only for a calibrated model, and fixes it with Platt or isotonic calibration on held-out data.

Open in interactive practice deck →

Original OfferVibe question. Topic idea from Inside the Machine Learning Interview (Peng Shao, 2023); text, examples and code are our own.
© 2026 OfferVibe · Text CC BY-NC-SA 4.0 · code MITFree to share and adapt with credit, not for commercial use. Code samples are free for any use.