Working paper 01

Probability calibration, measured and repaired in the browser

TrueOdds

Accuracy asks whether a classifier is right. Calibration asks whether a stated probability is trustworthy. This lab fits two post-hoc recalibrators on an independent calibration split, then measures their effect on untouched UCI Adult test predictions.

Dataset
UCI Adult
Rows
48,842
Model fit
60%
Calibration
20%
Test
20%

01 / Live analysis

Calibration Lab

All values below are computed locally from committed classifier outputs. No key, server, or library is used.

Reliability bins

Loading held-out predictions…

Figure 1

Reliability Diagram and Bin Counts

  • Raw
  • Temperature
  • Isotonic
  • Perfect calibration

Points compare mean predicted probability with the observed positive rate. The bars report the sample count behind each point. ECE and MCE change with the selected binning rule.

Reliability Data Table
Values plotted in Figure 1
Method Bin Mean probability Observed rate Count

Table 1

Held-Out Probability Metrics

Deltas are against raw predictions. Lower is better except for resolution and AUC. The Murphy rows group identical issued probabilities, independent of the display bins, so REL - RES + UNC reconstructs the Brier score exactly.

Raw and recalibrated metrics on the untouched test split
Metric Raw Temperature Delta Isotonic Delta

Decision study

Cost-Sensitive Threshold

Predict positive when the probability exceeds CFP / (CFP + CFN). Expected cost uses the displayed probabilities. Observed cost uses the held-out labels.

Optimal threshold 0.5000
Expected and observed cost per 100 test cases
Method Predicted positive False positive False negative Expected cost / 100 Observed cost / 100 Observed delta

02 / Method

What the Browser Computes

Reliability, ECE, and MCE

Each bin compares its observed positive rate acc(Bm) with its mean probability conf(Bm). ECE = sum |B_m|/n * |acc(B_m) - conf(B_m)|. MCE is the largest bin gap. Both are estimators whose value depends on bin edges, bin count, and sample size, so this lab exposes both binning schemes and the counts.

Brier Score and Murphy Decomposition

BS = n^-1 sum (p_i - y_i)^2 = REL - RES + UNC. Reliability penalizes disagreement between issued probabilities and event rates. Resolution rewards forecasts that separate groups with different event rates. Uncertainty is y_bar(1 - y_bar). Distinct issued probability values are the groups used for the exact identity.

Temperature Scaling

The browser applies sigmoid(logit(p) / T) and selects the single positive scalar T that minimizes calibration-split negative log likelihood. A bounded ternary search over T in [0.05, 20] replaces an optimizer dependency.

Isotonic Regression

PAVA sorts calibration probabilities, pools adjacent blocks whenever their fitted event rates decrease, and returns a non-decreasing step function. It can repair any monotone distortion, but its flexibility makes it easier to overfit small calibration sets.

Log Loss, AUC, and Decisions

Log loss is the mean binary negative log likelihood. AUC is computed directly from average ranks, including ties. Temperature scaling is strictly monotone and preserves AUC. Isotonic steps can create ties, so its AUC can move slightly. The decision threshold follows the Bayes rule for user-supplied false-positive and false-negative costs.

03 / Data

UCI Adult Income

Adult is a public binary-classification dataset derived from 1994 US Census records. The target is whether annual income exceeds $50K. The committed artifact contains only labels and four-decimal probabilities for the calibration and test splits. Raw demographic features are not shipped to the browser.

Four fixed-seed models provide deliberately different probability shapes: logistic regression, random forest, gradient boosting, and Gaussian naive Bayes. The source dataset is licensed CC BY 4.0. See the README for exact reproduction commands and citations.

UCI dataset record

04 / Limitations

What These Results Do Not Prove

  • ECE and MCE are bin-dependent estimates. A different scheme or count can change model comparisons.
  • Small bins have high variance. The histogram and table expose counts but do not provide confidence intervals.
  • Calibration learned on one population does not transfer reliably after dataset shift.
  • Isotonic regression can overfit when calibration data is scarce and can reduce ranking resolution by creating ties.
  • UCI Adult is a historical benchmark with documented social and demographic limitations. These models are not suitable for income decisions.