LearnQuestion bank

What does it mean for a classifier to be calibrated? How do you measure and fix calibration, and why does it matter for fraud or ads?

ML engineeringTechnicalMedium

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • Calibration means predicted probability equals observed positive rate within comparable score groups.
  • Measure with reliability diagrams, ECE, and Brier score.
  • Fix with Platt scaling, isotonic regression, or temperature scaling fitted on held-out data.
  • It matters when scores drive expected-value decisions or are combined with other models.
  • Resampling or class weighting breaks calibration unless corrected.

In full

A classifier is calibrated when its predicted probabilities match reality: among items scored 0.3, about 30% should be positive, and similarly across the whole range. I measure this with a reliability diagram, which plots predicted probability against observed frequency, plus ECE, the sample-weighted average absolute gap between confidence and accuracy across bins, and the Brier score, the mean squared error between predicted probability and outcome. To fix it, I fit a calibration map on held-out data rather than training data: Platt scaling for a logistic correction, isotonic regression for a flexible monotone mapping, or temperature scaling for a single logit adjustment, especially for neural networks. This matters because fraud and ads decisions are expected-value calculations: a bid, a loss estimate, or a threshold should use probabilities that mean something, and ensembles or downstream models also need comparable scores. Resampling or class weighting changes the effective prior and can make a model look better while destroying calibration, so I recalibrate on representative held-out data or correct for the prior shift before using the scores.

Checked against sources by an independent AI reviewer.

What a strong answer covers

  • Among items scored 0.3, about 30% should be positive.
  • Measure with a reliability diagram, ECE or the Brier score.
  • Fix with Platt scaling, isotonic regression or temperature scaling, fitted on held-out data.
  • Matters when scores feed expected-value decisions (auction bids, loss estimates) or get combined with other models.
  • Resampling or class weighting breaks calibration unless corrected.

Common mistakes

  • calibrating on training data
  • assuming a high AUC implies good calibration.