A model can rank positives above negatives and have a strong ROC AUC while assigning probabilities that are systematically too high or too low. A reliability diagram checks calibration by comparing average predicted probability with the observed positive rate in bins. Points near the diagonal indicate agreement.
Explore temperature scaling
Move the temperature control and watch the reliability curve change. Temperature scaling divides logits by a positive constant before converting them to probabilities. A higher temperature softens predictions toward the middle; a lower one makes them more extreme. Because the transformation is monotonic, it preserves score order, so ranking metrics such as ROC AUC do not change (apart from tie effects). Probability-based metrics and threshold decisions can change.
The visualizer uses a fixed synthetic example to show the effect. In practice, estimate calibration corrections on held-out data or out-of-fold predictions, then assess them on separate data.
Calibration methods
- Platt scaling: fits a logistic mapping from model scores to probabilities. It is compact and can work with modest calibration data when the score distortion is roughly sigmoid-shaped.
- Temperature scaling: adjusts neural-network logits with one parameter and preserves their order.
- Isotonic regression: fits a flexible monotonic mapping. It can model more shapes but needs enough calibration examples to avoid overfitting.
Calibration is model- and data-dependent. Logistic regression is not guaranteed to be calibrated, and random forests or neural networks are not guaranteed to be miscalibrated. Check the measured predictions rather than relying on model-family rules.
A simple calibration check
Imagine a bin of 100 predictions averaging 0.90, where 70 outcomes are positive. The bin is overconfident by 0.20. Expected calibration error (ECE) averages the absolute gap between confidence and observed rate across bins, weighted by bin size. ECE is convenient but depends on bin choices and can hide local errors; inspect the reliability curve and a proper score such as Brier score or log loss as well.
Common mistakes with Probability Calibration
- Using training data to calibrate: the correction can fit training-specific errors.
- Assuming high AUC means good probabilities: AUC measures ranking, not probability accuracy.
- Reporting ECE alone: different binning can change it, and positive and negative local errors can be obscured.
- Ignoring distribution change: calibration may drift as the population or measurement process changes.