What calibration means
A classifier is calibrated when, among examples it scored at probability p, the empirical positive rate is also p. Logistic regression is approximately calibrated by construction. Boosted trees and random forests are usually overconfident at the extremes and need calibration. Calibration matters whenever a downstream system uses the probability (cost-weighted thresholds, cascades, expected value).
Diagnostic: the reliability curve
Bin predictions into deciles, compute the empirical positive rate per bin, and plot it against the predicted probability. The closer the line is to y = x, the better the calibration. The Brier score is the single-number summary; lower is better.
Two practical fixes
- Platt scaling — fit a logistic regression on raw scores; works well with sigmoid-shaped miscalibration.
- Isotonic regression — fits a non-parametric monotone curve; needs more data but more flexible.
Both are wrapped by sklearn's CalibratedClassifierCV.