ML Systems Lab Open interactive version →
Intermediate 28 min read calibrationBrier scorePlatt scalingreliability diagram

Calibration & Brier Score

Reliability diagrams, Platt scaling, isotonic regression, Brier decomposition

A model can rank perfectly and still lie to you. Picture a mortality-risk model with a flawless AUC of 1.0 — it always ranks sicker patients above healthier ones. A doctor reads "90% risk" off it and prepares for the worst. But among all the patients this model stamps "90%," only 60% actually die. The *ranking* is perfect; the *number* is badly wrong. And the moment a real decision hangs on that number — a treatment, a price, an alert threshold — the wrong number costs you.

That gap has a name. Calibration asks: when the model says 0.9, does the thing happen 90% of the time? It is a completely separate question from *ranking* (which is what AUC measures). A model can nail one and fail the other.


Seeing it: the reliability diagram

Bucket the model's predictions (everything near 0.1, near 0.2, and so on) and, for each bucket, plot the predicted probability against the *actual* fraction that came true. A perfectly calibrated model sits on the diagonal where "predicted = actual." Points that fall *below* the diagonal mean overconfidence — the model says 0.8 for things that happen only 0.55 of the time. Modern neural networks are almost always overconfident, and it gets worse toward the high end, because they are trained with a loss that rewards confident predictions even on noisy labels.


Putting a number on it: ECE and Brier

Two numbers summarise calibration. ECE (expected calibration error) is just the average gap between those buckets and the diagonal — lower is better, zero is perfect. It is handy but coarse: a low ECE can still hide bad miscalibration in one probability range, so always look at the diagram too, not only the single number.

The Brier score goes further. It is simply the mean squared error of the probabilities — the average of (predicted − actual)², where actual is 0 or 1. Lower is better. What makes it special is that it rolls *both* things you care about into one number: how well the model *separates* the classes (discrimination) *and* how honest its probabilities are (calibration). So a model with great AUC but poor calibration shows a good discrimination part and a bad calibration part inside its Brier score — which is exactly why a model with *lower* AUC can still have the *lower* (better) Brier score, by paying its way in calibration.


Fixing it — on a separate calibration set

You do not usually retrain; you patch the probabilities afterward, using a held-out calibration set (never the training or test data). Three common tools, cheapest first. Temperature scaling (for neural nets): divide the logits by a single number T before the softmax — T > 1 softens overconfident outputs, and it never changes which class wins, only the probabilities. One parameter, impossible to overfit, and it fixes the most common kind of neural-net miscalibration, so try it first. Platt scaling: fit a small logistic curve on top of the scores — good for the smooth, one-directional miscalibration of SVMs and boosting, and it works with little data. Isotonic regression: fit a flexible staircase that can straighten any shape of miscalibration — more powerful, but it needs more data or it just memorises. And the rule you cannot break: fit the correction on a *separate* slice. Calibrate on training data and it is fooled by memorised outputs; calibrate on test data and you have spoiled your only honest score.


The Brier decomposition, by its actual terms

We said Brier folds two things together — here they are precisely. The Murphy decomposition splits it into three: Brier = reliability − resolution + uncertainty. Reliability is the calibration error (how far predictions sit from the true rate in their bucket) — you want it *low*. Resolution is how much the predictions vary from the base rate and correctly separate outcomes (discrimination) — you want it *high*, and it's *subtracted*. Uncertainty is the irreducible difficulty set by the base rate, which no model controls. The critical consequence: a lower Brier does not always mean better calibration — it can drop purely because *resolution* improved (better discrimination) while calibration stayed the same or worsened. So don't read Brier as a pure calibration metric; it mixes calibration, discrimination, and base-rate difficulty. sklearn warns about exactly this.


ECE's fine print

ECE is more fragile than its single number suggests. It depends heavily on bin count (10 bins vs 20 gives different ECE) and bin placement; empty or tiny bins make the estimate noisy; equal-width bins waste resolution when predictions cluster (fixable with adaptive/equal-count binning). And in multiclass you must choose *what* to measure: top-label ECE (is the confidence in the predicted class honest?) versus classwise ECE (is every class's probability honest?) — they answer different questions and can disagree. Always pair ECE with the reliability diagram so a small number can't hide localised miscalibration.


Calibrating more than two classes

Multiclass calibration is genuinely harder. The one-vs-rest approach fits one calibrator per class, but then the per-class probabilities no longer sum to 1 and need renormalising. You also decide between calibrating the top label only versus classwise (every class), and you inspect classwise reliability diagrams rather than one curve. Temperature scaling is popular here precisely because scaling all logits by a single T keeps the softmax normalised and sidesteps the renormalisation headache.


Model-specific miscalibration patterns

Different models miscalibrate in characteristic directions. Random forests are pushed *away* from 0 and 1 by tree-averaging (a truly-positive case rarely gets every tree to vote yes), giving a sigmoid-shaped reliability curve — under-confident at the extremes. Modern neural networks are commonly overconfident (curve sags below the diagonal), though this is a tendency, not a universal law — it depends on architecture, loss, and regularisation. Knowing your model's usual distortion tells you which correction shape to expect.


Calibration decays after deployment — monitor it

Calibration measured at launch is not permanent. Covariate shift (the input mix moves) and base-rate shift (the positive rate changes) both break it even when the original test calibration looked perfect. So calibration is something to monitor in production — track ECE/reliability over time and, crucially, *by cohort*: time window, geography, device, and segment, since a model well-calibrated overall can be badly off for a subgroup whose prevalence shifted.


Calibration is not thresholding

Keep the two steps separate. Calibration makes the probability *truthful* (0.7 means 70%). Thresholding picks the *decision cutoff* that turns a probability into an action, chosen from costs and capacity. They're related — an honest probability makes the threshold meaningful and transferable across contexts — but distinct: you calibrate so the number can be trusted, *then* threshold so the decision is optimal. Fixing one does not fix the other.

Key points

Takeaway

AUC measures whether a model ranks correctly and calibration measures whether its probability estimates are honest — these are independent, so for any application where the probability output drives a real-world decision, calibration must be evaluated and fixed separately from discrimination.

Recap

Check your understanding

Q1. A model has AUC = 0.91 and ECE = 0.15. What does this mean and what do you do?

Q2. Your reliability diagram shows the model is overconfident at high probabilities (0.8-1.0 bucket shows actual positive rate of 0.55). Which two of the following are valid explanations and fixes? Select two.

Q3. Two models: Brier score for Model A = 0.08, for Model B = 0.12 on the same dataset. Model B has higher AUC. How do you interpret this?

Q4. A colleague says "our Brier score dropped from 0.12 to 0.09 after the last change, so the model is better calibrated now." Why is that conclusion not guaranteed?

Q5. A binary model was well-calibrated at launch (ECE 0.02). Three months later the base rate of positives has shifted and users complain the probabilities feel off, though ranking is unchanged. What's happening and what should have been in place?

Try it interactively

ML Systems Lab is a free interview-prep platform for ML engineers — work through the full interactive module, quizzes, and drills.

Open ML Systems Lab →