Model Evaluation
Advanced 16 min read Model Evaluation

Probability Calibration

Turning scores into probabilities people can trust

A score of 0.7 only means '70% likely' if probabilities are calibrated. Reliability curves, Brier score and Platt/isotonic rescaling keep decision systems from over-trusting softmax or sigmoid outputs.

calibrationreliability curveBrier scorePlatt scalingisotonic regressionsoftmax
Before we start

What you will learn

  • Diagnose miscalibration with reliability curves and Brier score
  • Apply Platt and isotonic rescaling and know their trade-offs
  • Explain why neural-net softmax outputs are not calibrated probabilities
Introduction

What is this?

Calibration means that among all examples scoring 0.7, about 70% are truly positive. A model can have perfect ranking (AUC 0.95) yet be badly miscalibrated — scores shifted or squeezed — because scoring rules during training (log-loss, margin) do not force the output to equal the true event rate. Calibration fixes the mapping from score to probability, typically with a reliability plot + Brier score diagnosis and Platt or isotonic rescaling as the remedy.

Motivation

Why do you need it?

  • Decision rules like 'take action when risk > 30%' are only correct if 0.3 means 30%.
  • Insurance, lending and medicine price risk off probabilities, not just rankings.
  • Neural networks overconfident by default: softmax hoodwinks even experienced teams.
  • A model can win on AUC and lose money on calibration.
Think about it

Mental model

Imagine

A weather forecaster

Think of

A probability model

'70% chance of rain' is only useful if, on the days you say 70%, it rains seven times out of ten. The forecaster is graded on calibration, not on whether any single forecast was right.

Mechanics

How it works

  • Collect the model's scores on a held-out set along with the true labels.
  • Bin the scores (e.g., deciles); per bin, compare the mean predicted score to the observed positive rate.
  • Plot predicted vs observed — points on the diagonal are perfectly calibrated; below the line means over-confidence.
  • Quantify with Brier score = mean((p_hat - y)²), lower is better; decompose into calibration + refinement.
  • Remedy: fit a monotonic transform on a separate set — Platt logistic regression for smooth curves, isotonic regression for data-rich, flexible fits.

Reliability curve: predicted vs observed risk.

Scores
Bin
Observed rate
Plot + Brier
Rescale
Real world

In production

  • A credit-risk engine rescales scores with isotonic regression before feeding pricing, because a '0.9 default risk' must literally mean a 90% rate.
  • An ICU mortality model gates ICU admission on calibrated risk thresholds — miscalibration would mis-triage patients.
  • A churn team uses reliable probabilities to rank saving-campaign spend by expected lift, not just rank order.
Guidelines

Best practices

  • Always fit the calibration transform on data the model didn't see (a calibration hold-out or inner fold).
  • Diagnose with a reliability curve before rescaling — the shape tells you which fix fits.
  • Retrain calibration regularly: drift makes previously-calibrated scores unreliable.
  • Report Brier score, which is threshold-independent, in addition to any threshold metrics.
Watch out

Common mistakes

  • Reading softmax/sigmoid outputs as calibrated just because they lie in [0,1].
  • Fitting Platt/isotonic on the training set, double-dipping the data and overfitting the remap.
  • Assuming calibration is permanent — deployed distributions shift, so re-verify periodically.
  • Applying calibration to change the ranking; monotonic rescaling preserves order but distorts separation.
Root cause analysis

Common issues

Error
Calibrated probabilities look flat or degenerate
Root cause

Isotonic regression overfitting tiny bins on a small calibration set

Fix

Fold to Platt scaling or reduce bins, and use at least ~1k calibration points.

Error
Calibration worsens a downstream cost function
Root cause

The transform changed the score distribution shape the cost model depended on

Fix

Recalibrate in the score space the downstream system consumes and re-test the full pipeline.

When things break

Debugging tips

  • Reliability curve S-shaped below the diagonal? Overconfidence — common for boosted trees on separable data.
  • Brier better on train than test? The calibration fit is overfit; use a larger calibration set or simpler Platt.
  • AUC unchanged after calibration is expected — calibration improves probabilities, not ranking.
  • If the curve is all over the place, the bins are too small; use quantile bins.
Interviews

Interview checkpoint

Practice

Hands-on lab

Rebuild Calibration With a Reliability Curve
30 min · advanced
In progress
Objectives
  • Train a classifier and expose its miscalibration
  • Draw a reliability curve by binning scores
  • Apply Platt and isotonic rescaling and compare Brier scores

Rebuild Calibration With a Reliability Curve

30 min · advanced

0/4 steps
0%
sandbox · Linux sandbox
$
Try these commands
Test yourself

Quick quiz

0/2
1

A perfectly calibrated model means:

2

Calibration preserves the model's ranking of examples.

Go deeper

Official documentation