Classical machine learning
Calibration, Uncertainty, and Abstention
Distinguish scores, probabilities, support, and decision confidence; fit calibrators and design abstention with coverage and fallback evidence.
By the end you can
- Distinguish model scores, calibrated probabilities, support signals, and decision confidence
- Compare sigmoid and isotonic post-hoc calibration
- Design leak-resistant calibration and abstention development
- Evaluate coverage, subgroup calibration, shift, and fallback operations
Visual
A prediction can carry several kinds of confidence
The word confidence often collapses several quantities. Those quantities have different meanings and different validation needs.
Each of them is checkable against something. A score is checked against an ordering. A probability is checked against observed frequencies. A support signal is checked against the data the model actually saw. A decision policy is checked against what happened to the cases it accepted and the cases it pushed elsewhere. The rest of this lesson keeps them apart by looking at measurements where the difference has already been quantified.
Model score
An internal ranking value such as a margin, logit, or vote fraction.
Calibrated probability
A frequency claim tested against comparable outcomes.
Prediction interval or set
A range or set designed to contain an outcome under stated conditions.
Support signal
Evidence about density, distance, novelty, or data quality.
Decision confidence
A workflow judgment combining probability, cost, support, and available fallback.
Calibration connects predicted probabilities to observed frequencies
If many cases receive a predicted probability near 0.20, roughly one fifth should exhibit the event in a well-calibrated setting. Calibration is conditional on the evaluation population, time, and grouping.
A model can be calibrated overall. It can be miscalibrated within important subgroups or score ranges.
How much data a calibrator needs has also been measured. Learning curves published in 2005 compared Platt scaling and isotonic regression across eight classification problems. Isotonic regression is the more powerful method. For exactly that reason it “is easier for it to overfit when the calibration set is small”, wrote Niculescu-Mizil and Caruana. The curves also give the crossing point: “when there are 1000 or more points in the calibration set, Isotonic Regression always yields performance as good as, or better than, Platt Scaling”. Scikit-learn's calibration guide documents the same threshold from the other side. Isotonic “will perform as well as or better than ‘sigmoid’ when there is enough data (greater than ~ 1000 samples) to avoid overfitting”. Below that count, the flexible method is the riskier one.
Comparison
Post-hoc calibrators trade flexibility and data needs
Calibration needs its own predictions. They must not be predictions that were used to train the base model.
The trade is not a matter of taste, and the numbers for it are on the record. On CIFAR-100 a 110-layer ResNet had an expected calibration error of 16.53%, measured with M=15 bins. A 5-layer LeNet on the same data had 4.85%. The deeper, more accurate model was the badly calibrated one. “The average confidence of LeNet closely matches its accuracy, while the average confidence of the ResNet is substantially higher than its accuracy,” wrote Guo, Pleiss, Sun and Weinberger, who measured it in 2017.
The repair on that same ResNet ranks the methods in this table. Temperature scaling is the least flexible mapping available. It cut the error to 1.26%. Isotonic regression, which is more flexible, reached only 4.99%. Matrix scaling, more flexible still, produced 25.49% — worse than the 16.53% of doing nothing at all. Flexibility bought nothing here. Past a point it cost more than it returned.
None of this is permanent. Minderer and colleagues re-measured the same quantity across newer architectures in 2021. They reported that the most recent models, notably those not using convolutions, are among the best calibrated, and that the decay of calibration with model size or distribution shift is less pronounced in recent architectures. Measure the calibrator on your own scores. Do not memorise a ranking of methods.
Logistic or sigmoid calibration
Fits a smooth monotonic mapping from score to probability.
- Data-efficient
- Limited shape flexibility
- Common for margin scores
- Can miss non-sigmoid distortion
Isotonic regression
Fits a flexible monotonic step function.
- Adapts to irregular distortion
- Needs more calibration data
- Can overfit small samples
- Produces piecewise-constant probabilities
Built-in probabilistic model
Uses the estimator likelihood or leaf frequencies.
- No extra mapping by default
- May already be reasonable
- Still requires empirical checking
- Can shift after deployment
No probability claim
Uses scores only for ranking or threshold decisions.
- Avoids false precision
- Still needs operating validation
- Cannot support probability-based utility directly
- May be sufficient for retrieval
Example
How calibration fails while headline accuracy looks stable
Probability errors often stay invisible. They appear only when predictions are used for pricing, prioritization, or resource allocation.
The best-documented case is a proprietary risk score running inside hospital software. The Epic Sepsis Model was validated externally in 2021 across 27,697 patients and 38,455 hospitalizations, of whom 2,552 (7%) developed sepsis. Its hospitalization-level AUC was 0.63 (95% CI, 0.62-0.64). It failed to identify 1,709 patients with sepsis, 67% of them. It still generated alerts on 6,971 of the 38,455 hospitalizations, 18%. “This external validation cohort study suggests that the ESM has poor discrimination and calibration in predicting the onset of sepsis,” concluded Wong and colleagues in JAMA Internal Medicine. Both halves of that sentence matter. The ranking was weak and the probability scale was wrong. Neither was visible from the deployed alert itself.
An independent look at Epic's model v1.0 followed in 2024, in two county emergency departments, covering 145,885 encounters from 2023. Sensitivity was 14.7%. Positive predictive value was 7.6% within a 6-hour window. A score can be in production at scale for years, be measured once, and be found this far off.
- Prevalence shift: the ranking remains similar but a 30% training-era risk no longer corresponds to 30% in deployment.
- Subgroup distortion: overall reliability looks good because overprediction in one group cancels underprediction in another.
- Small isotonic sample: a flexible calibrator creates large steps driven by a few validation outcomes.
- Case-control training: oversampled positives produce inflated raw probabilities without prior correction.
- Workflow feedback: interventions prevent some predicted outcomes, changing the meaning of observed calibration.
Calibration needs more than one chart or score
Reliability diagrams show observed frequency against predicted probability, but binning choices can hide variation. Brier score combines calibration and discrimination components. Log loss strongly penalizes confident wrong predictions.
Use counts, uncertainty, and slice views alongside summary metrics.
The Brier score is older than machine learning, and it was built for exactly the problem this lesson has. It appeared in Monthly Weather Review in January 1950, in three pages, from Glenn W. Brier of the U.S. Weather Bureau. The point was not to summarise accuracy. It was to remove an incentive. “It is the purpose of this paper to discuss one situation where it appears to be possible to devise a verification scheme that cannot influence the forecaster in any undesirable way,” he wrote in the introduction. A forecaster cannot improve the score by hedging. Nearly forty years later, in 1988, NOAA's National Weather Service Central Region still described it as “one of the most widely used verification scores for probability of precipitation (POP)”. That is what a proper scoring rule is for, and why it belongs beside the diagram rather than after it.
The binning is not a presentation detail either. It changes the number. A 2019 paper showed that “popular recalibration methods like Platt scaling and temperature scaling are (i) less calibrated than reported, and (ii) current techniques cannot estimate how miscalibrated they are”. Its scaling-binning calibrator “requires O(1/ε² + B) samples”, where scaling methods need O(B/ε²). The same authors note that “an alternative estimator introduced in the meteorological community requires fewer samples (O(√B) instead of O(B))”. On CIFAR-10 and ImageNet their method achieves “35% lower calibration error than histogram binning”. A calibration figure nobody can verify is a claim, not a measurement.
Steps
Add calibration and abstention without contaminating evaluation
Probability and deferral policies require their own development evidence.
The steps below are not one team's house style. Ten Good Machine Learning Practice guiding principles for medical device development were published jointly in October 2021 by the U.S. FDA, Health Canada and the UK's MHRA. Health Canada dates its posting 27 October 2021. Three of those numbered principles say what steps 3, 5 and 6 say. Principle 8 requires clinically relevant testing independent of the training set and covering important subgroups. That is step 3, validation on untouched data, written as a regulatory expectation. Principle 10 requires deployed models to be monitored in real-world use, with controls for overfitting, unintended bias and dataset drift. That is step 6.
Principle 7 is the one that governs abstention, and it is worth reading in full: “Where the model has a "human in the loop," human factors considerations and the human interpretability of the model outputs are addressed with emphasis on the performance of the Human-AI team, rather than just the performance of the model in isolation.” A deferral rule that has only been evaluated on the cases the model kept has not been evaluated against that principle at all.
1. Produce out-of-fold scores
Generate predictions from models that did not train on those rows.
2. Fit the calibrator
Train the mapping only on designated development predictions.
3. Validate probability quality
Check reliability, proper scoring rules, and slices on untouched data.
4. Define support gates
Use missingness, novelty, density, or range checks.
5. Choose abstention rules
Balance accepted-case risk against coverage and fallback capacity.
6. Monitor after action
Track prevalence, calibration, interventions, and deferred-case outcomes.
Analogy
A weather forecast plus a travel rule
A forecast says 30% rain, and a traveler carries an umbrella only when rain risk, trip length, and inconvenience justify it. The probability claim and the action rule are related but separate.
Rain ignores the forecast. Model predictions can influence the outcome, and subgroup calibration can differ. An umbrella decision also has simpler feedback than many high-stakes systems.
Calibration tests the forecast; decision policy determines what the forecast should cause.
Key idea
Abstention can move errors into a hidden queue
Deferring uncertain cases may improve metrics among accepted predictions while overwhelming reviewers or disproportionately rejecting one group. Coverage, wait time, reviewer accuracy, and downstream outcomes must be included.
A selective model is a model plus a fallback system.
One regulated device makes the queue visible because it was required to. IDx-DR returns one of three outputs: more than mild DR detected, not detected, or insufficient quality. Abstention there is not an internal convenience. It is a declared device output. FDA authorised the device under De Novo request DEN180001 on 12 January 2018, under a new Class II regulation, 21 CFR 886.1100. Its pivotal trial enrolled 900 participants at 10 primary care sites. Imageability was 96.1% (95% CI, 94.6-97.3%), sensitivity 87.2%, specificity 90.7%.
Then FDA counted the deferred cases, which is the step usually skipped. “In the 38 participants with AI system insufficient image quality, the prevalence of mtmDR was 10/38 (26%), comparable to the mtmDR prevalence in the fully analyzable dataset,” records the decision summary. The abstained group was not an easy residue. It carried the disease at about the rate of everyone else. The reported sensitivity of 87.2% says nothing whatever about those 38 people.
Accepted-case performance is incomplete without the cost and quality of what happens after abstention: 87.2% sensitivity describes the images that were readable, not the 38 participants whose were not.
Calibration is usually less stable than ranking under prevalence change
A monotonic score can preserve ordering while absolute risk changes. Updating a calibrator may then be appropriate, when the conditional relationship is stable enough and new mature labels are available.
Do not recalibrate blindly when feature relationships, interventions, or target definitions also changed. Refitting a mapping from score to probability answers one question: has the probability scale drifted. It silently assumes the answer to another, which is whether the ordering underneath it still holds. When both have moved, a new calibrator will make the reliability diagram look repaired while the decisions stay wrong.
Probability maintenance begins with diagnosing which part of the data-generating process moved.
Use probability language only when the evidence supports it
Terms such as risk, chance, and likelihood invite frequency interpretation. If the output is an uncalibrated margin or vote, call it a score and document the operating threshold.
Avoid confidence percentages that merely rescale an arbitrary model output.
The most disciplined version of this practice is public and tabulated. The IPCC's calibrated likelihood scale assigns numbers to its words: virtually certain 99-100%, very likely 90-100%, likely 66-100%, about as likely as not 33-66%, unlikely 0-33%, very unlikely 0-10%, exceptionally unlikely 0-1%. That table has been in the panel's uncertainty guidance for authors since 2010. Every author writing “very likely” is writing 90-100%, by rule.
Even that is not sufficient, which is the part worth carrying into your own reporting. A study of 25 samples in 24 countries and 17 languages found the words drifting on the way to the reader. “As predicted, laypeople interpret IPCC statements as conveying probabilities closer to 50% than intended by the IPCC authors,” its authors wrote in Nature Climate Change in 2014. Their measured fix is mechanical rather than rhetorical: printing the numerical range alongside the word increased agreement with the guideline. Define the term. Then print the number next to it anyway.
Honest naming is part of statistical safety.
Key takeaways
- An internal score, a calibrated probability, a support signal, and a decision policy are different objects.
- Calibration means predicted probabilities match observed frequencies in a defined population and period. A more accurate model can be the worse-calibrated one: 16.53% expected calibration error for a 110-layer ResNet against 4.85% for a 5-layer LeNet on CIFAR-100.
- Flexibility is not free. Temperature scaling cut that ResNet to 1.26%, while isotonic reached 4.99% and matrix scaling reached 25.49% — worse than no calibration. Isotonic only reliably beats Platt scaling above roughly 1,000 calibration points.
- Calibrators must be fit on out-of-sample base-model predictions and tested on untouched evidence, with proper scoring rules that a forecaster cannot improve by hedging. That was the purpose Brier stated in January 1950.
- Abstention transfers work to a fallback whose quality must be measured: 10 of the 38 participants IDx-DR declined to read had more-than-mild diabetic retinopathy, at the prevalence of the accepted cases.
- Prevalence, interventions, target definitions, and subgroup behavior can change probability meaning after deployment. The words used to report a probability shift too, unless the number is printed beside them.