Context. Learners were mostly compared on accuracy and ROC area, but a cost threshold makes the right decision only if is an accurate probability. Niculescu-Mizil and Caruana (2005) asked which of ten standard learners produce calibrated probabilities and how much held-out data a post-hoc fix needs, and found neural nets among the best calibrated. Twelve years later the nets are deep, wide, batch-normalized, lightly regularized and far more accurate, and Guo et al. find them overconfident. Miscalibration has a shape set by the learning method, and since any increasing map preserves the ranking, calibration is a separate one-dimensional regression on held-out data whose family should be the smallest one that contains the distortion. Margin maximizers squeeze scores into a sigmoid, naive Bayes pushes them to the extremes, and modern nets inflate their logits by one global scale, which a single temperature undoes without changing a prediction. For rare positives the distortion that matters can be a base-rate error, which needs an intercept, and it has to be checked in the tail where decisions are made.
Setting. A score is calibrated if ; for a -class network with logits , the confidence is calibrated if . A reliability diagram plots mean prediction against observed rate in equal-width bins, and with bins The calibrators, all fit on held-out data, are Platt scaling, fit by maximum likelihood with smoothed targets and ; isotonic regression, the least-squares increasing step function by pool-adjacent-violators; histogram binning and Bayesian binning into quantiles (BBQ), run one class against the rest and renormalized; and three multiclass extensions of Platt, matrix scaling , vector scaling (diagonal ), and temperature scaling with one scalar chosen by validation NLL. The 2005 study uses eight binary problems with 3% to 53% positives, 4,000 training and 1,000 calibration cases; the 2017 study uses vision and text benchmarks with ResNets, DenseNets and their kin.
Maximum-margin methods squeeze scores toward the middle, and a sigmoid undoes it. Boosted-tree scores have almost no mass near 0 or 1 and the reliability curve is a sigmoid on seven of eight problems; boosted stumps are the most extreme, and SVMs behave alike. The companion paper explains this through margins. To widen the margin of hard cases near the boundary, boosting gives up margin on easy ones, so scores pile up on either side of it. Friedman et al.'s reading of AdaBoost as fitting half the log-odds makes a sigmoid of the normalized vote the right family (my derivation):affine in , leaving a slope and an offset to fit. The slope and offset the theory implies fail for boosted full trees, which separate the training set and inflate , so the two parameters are fit on held-out data.
Naive Bayes pushes scores to the extremes, averaging keeps them off the edges, and log-loss learners are already calibrated. Naive Bayes adds one log-likelihood ratio per attribute, so correlated attributes count the same evidence several times and the log-odds overshoot; the correction it needs bends the other way from a sigmoid in , so isotonic regression fits it better; a sigmoid in and can bend either way, which beta calibration later added (Kull et al., 2017). Random forests show a mild sigmoid on five problems because an average reaches 0 only if every tree says 0, so near the edges any noise moves it inward; bagged trees stay close to calibrated. A neural net with a sigmoid output trained on log loss is in effect Platt-scaled during training, so in 2005 it sat on the diagonal with logistic regression.
Platt wins on small calibration sets, isotonic on large ones, and calibrating a calibrated model hurts. The tradeoff is bias against variance in the map. Two parameters with smoothed targets cannot overfit much, while an isotonic fit has as many steps as the data allow. Platt is better for every learner plotted below roughly 200 to 1,000 calibration cases, and isotonic is as good or better from 1,000 on. The paper counts cases, but an isotonic step is determined by the positives in it (my reading): at 3% positives a set of 1,000 holds about 30, and at fraud-like rates of 0.1% it holds one, so the calibration set has to be sized in positives. On already calibrated models, Platt scaling moves mass away from 0 and 1, because a sigmoid of a score is never the identity; fitting it on the log-odds instead puts the identity at . After calibration, boosted trees give the best probabilities of the ten learners, and in the companion paper boosting full trees directly on log loss does badly, pushing predictions toward 0 and 1.
Modern nets are overconfident, and the settings that maximize accuracy are not the ones that calibrate best. Most uncalibrated 2017 models have ECE between 4% and 10%, up to 16.5% on CIFAR-100. There LeNet's average confidence is close to its accuracy, while ResNet-110 sits well above it. On CIFAR-100, ECE grows with depth and width while error falls, batch normalization worsens calibration while slightly improving accuracy, and calibration keeps improving as weight decay rises well past the value that minimizes error. These are single-dataset correlations with no causal claim, as the paper says.
NLL overfits while 0/1 error does not, and this produces the overconfidence. Training a ResNet-110 on CIFAR-100, test NLL rises after the learning rate is lowered while test error keeps falling. Once nearly every training point is classified correctly, the loss can still fall by scaling the logits up, which raises confidence everywhere, including on test points the net gets wrong, and the optimal temperature rises steadily through training. So high-capacity models that seem immune to overfitting do overfit, in log loss. For a linear model on separable data, gradient descent grows the weight norm like while the direction converges (Soudry et al.), and a growing norm at a fixed direction is exactly a falling temperature.
Temperature scaling fits that one degree of freedom, and on benchmarks the simplest method wins. Dividing by a positive scalar keeps the argmax, so accuracy is untouched, and the NLL is convex in . Its first-order condition is a moment match, the maximum-entropy characterization the paper derives:the average logit of the true class equals its expectation under the model. That one parameter suffices is an empirical finding: vector scaling, free to scale each class, lands on nearly constant entries. On CIFAR-100 ResNet-110, ECE is 16.53% uncalibrated, 2.66% with histogram binning, 4.99% isotonic, 1.26% with temperature scaling and 25.49% with matrix scaling, whose parameters overfit with many classes. The one-against-rest binning methods can change the argmax after renormalization: on ImageNet DenseNet-161, error goes from 22.57% to 48.32% with histogram binning. On text temperature scaling is comparable but not always best.
Consequences and limits. Discrimination and calibration are separate jobs, and the right calibrator is the smallest family that contains the distortion: a sigmoid for margin methods and small sets, isotonic regression for large ones, and mostly a scale for modern nets. A temperature corrects scale only, though, and in a binary problem with rare positives an error in the base rate is an intercept, which needs Platt's on the logit. Binned ECE can also hide what matters for a cost threshold. In a check of mine, a model at a 0.7% base rate (true log-odds normal with mean and standard deviation 1.5) whose odds are all doubled has 15-bin ECE of 0.66%, which is just its average overprediction and looks small on the usual 4% to 10% scale, while among its top 1% of scores it predicts 22% against an observed 12.7%. The best temperature () leaves 18.7% against 12.7%, and a two-parameter Platt fit recovers the intercept, against . For a fraud stack ending in a gradient-boosted tree model, only the procedure carries over directly. A modern GBDT trained on log loss with shrinkage and shallow trees is not the AdaBoost studied here, and log-loss boosting of high-capacity trees errs toward 0 and 1. So draw the reliability curve on recent held-out data around , calibrate on the raw margin, where the identity is in the Platt family, with an intercept, and refit when base rates or fraud patterns shift, since a calibration map holds only for the distribution it was fit on. Later work found binned ECE to underestimate miscalibration (Kumar et al., 2019), in-distribution temperature scaling to degrade under shift (Ovadia et al., 2019), and newer non-convolutional architectures among the better calibrated, so "bigger is worse" is a trend of the 2017 model families (Minderer et al., 2021).
Terms
- Reliability diagram
- Mean prediction against observed positive rate in ten equal-width bins; calibrated models lie on the diagonal.
- Sigmoid distortion
- Scores squeezed toward the middle (boosting, SVMs); the true rate is a sigmoid of the score.
- Inverted sigmoid
- Scores pushed to 0 and 1 (naive Bayes, which double-counts correlated evidence).
- Platt scaling
- , two parameters fit by likelihood on held-out data with targets , .
- Isotonic regression
- Least-squares increasing step function of the score, by pool-adjacent-violators; fits any monotone distortion.
- Data rule
- Platt below about 200 to 1,000 calibration cases; isotonic at least as good from 1,000 up.
- ECE
- over 15 equal-width bins; weights bins by their mass.
- NLL overfitting
- Test log loss rises while test error falls, because the logits keep growing after the fit is perfect.
- Temperature scaling
- , one scalar fit by validation NLL; keeps the argmax, so accuracy is unchanged.
- Binary temperature
- Platt scaling on the logit with no intercept; cannot correct a base-rate error.
Quiz
- What evidence supports the claim that miscalibration is low dimensional?Vector scaling could fit a different scale per class but chooses almost constant entries. The distortion is then essentially one common rescaling of the logits, the degree of freedom a temperature has.
- A binary fraud model doubles every odds because of a base-rate error. What fixes it?Doubling the odds adds to every logit, which is an intercept. A temperature only rescales the logit and cannot cancel a constant shift; Platt's recovers .
- Why can a rare-positive model have small ECE yet badly misstate probabilities near its threshold?Each bin's gap is weighted by its share of cases. With a 0.7% base rate, the bulk near zero dominates and the sparse high-score bins, where the decisions are made, barely move the sum.
- Platt scaling on the score slightly hurts already calibrated neural nets. What is the structural reason?The family on has bounded range and curvature that the identity lacks, so it distorts a model needing no correction. Fitting the sigmoid on the log-odds instead puts the identity inside the family.
Sources
- Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. On Calibration of Modern Neural Networks. ICML, 2017.
- Alexandru Niculescu-Mizil and Rich Caruana. Predicting Good Probabilities With Supervised Learning. ICML, 2005.
- Meelis Kull, Telmo Silva Filho, and Peter Flach. Beta calibration: a well-founded and easily implemented improvement on logistic calibration for binary classifiers. AISTATS, 2017.
- Ananya Kumar, Percy Liang, and Tengyu Ma. Verified Uncertainty Calibration. NeurIPS, 2019.
- Yaniv Ovadia et al. Can You Trust Your Model's Uncertainty? Evaluating Predictive Uncertainty Under Dataset Shift. NeurIPS, 2019.
- Matthias Minderer et al. Revisiting the Calibration of Modern Neural Networks. NeurIPS, 2021.