“Our model ranks cases well. Can we treat its scores as probabilities?”
Not without checking. Ranking asks whether positives tend to receive higher scores. Calibration asks whether predicted probabilities agree with observed frequencies in the evaluated population.
01. Interpret a probability as a frequency claim
Suppose 100 sufficiently similar scored cases have predicted probabilities near 0.8, but only 50 are positive. That region of scores appears overconfident. With a calibrated model, we would expect the observed fraction to be near 0.8 over enough comparable cases, allowing for sampling noise.
A constant prediction equal to the population base rate can be calibrated while offering no useful ranking. Conversely, multiplying every positive score by a monotonic transformation can preserve ordering while distorting its probability interpretation.
This matters in ad selection, where predicted click probability may enter an expected-value calculation, and in risk decisions where costs depend on estimated likelihood.
02. Measure reliability carefully
A reliability diagram groups predictions into bins and compares average prediction with the observed positive fraction. Show bin counts: a dramatic discrepancy in a bin with five observations is different evidence from the same discrepancy in a bin with 50,000.
| Illustrative bin | Mean prediction | Positive fraction | Count |
|---|---|---|---|
| Low | 0.10 | 0.12 | 1,000 |
| Middle | 0.50 | 0.35 | 200 |
| High | 0.90 | 0.70 | 100 |
Log loss and Brier score assess probabilistic quality, but they mix calibration with other aspects of prediction. A lower score alone does not prove calibration improved. Binning-based summaries depend on the binning convention and sample size.
03. Fit the calibrator without leakage
Train the base model on training data. Fit a calibration mapping on held-out predictions or appropriately generated out-of-fold predictions, then evaluate the full procedure on untouched data. Never train the calibrator on the base model's optimistic in-sample predictions and call that an honest assessment.
Sigmoid calibration fits a constrained mapping. Isotonic regression is more flexible but can overfit when calibration data is limited. Validate the method on the domain and sample size rather than assuming flexibility is always better.
scikit-learn's calibration guide describes these methods and evaluation cautions.
04. Preserve the operating context
A calibration mapping learned on a balanced sample may not represent the natural base rate. Preserve representative data or explicitly account for sampling. Evaluate by relevant cohorts, because acceptable aggregate calibration can conceal systematic subgroup differences.
Version the base model and calibrator together. A mapping trained for yesterday's model is not automatically compatible with a newly retrained scorer. Track probability distributions and mature outcomes after release.
Calibrating scores does not establish causal effects, solve exposure bias, or choose an action threshold. Those remain separate parts of the system.
05. Answer the follow-up
“Will recalibration fix concept drift?”
Only sometimes. It can adjust a distorted score-to-frequency relationship, but cannot recover lost ranking signal or add missing features. Diagnose the change before choosing a remedy.
Explain how a model can be calibrated but uninformative, and why a calibrator needs data the base model did not fit.
Sources & further reading
scikit-learn: probability calibration. Bin counts and outcomes above are illustrative.
Continue your preparation
Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.