TensorTau PathToAGI Doing Machine Learning Honestly Level 05

Level 05 · Doing Machine Learning Honestly · Chapter 062

Calibration and Uncertainty

When a model says “80% confident,” should events like that really happen about 80% of the time?

1. Accuracy and calibration are different

A classifier can rank examples perfectly while producing terrible probabilities. If among all predictions near 0.8, roughly 80% are actually positive, that region is well calibrated.

predicted 0.2 → about 20% positive
predicted 0.5 → about 50% positive
predicted 0.8 → about 80% positive

2. Reliability diagrams

Bin predictions by confidence and compare average predicted probability with observed frequency. Perfect calibration lies near the diagonal.

Metrics such as Brier score measure probability quality:

Brier=1N∑i(pi−yi)2.\text{Brier}=\frac1N\sum_i(p_i-y_i)^2.

3. Why uncertainty matters

In medicine, autonomous systems and human-in-the-loop workflows, “I am unsure” can be more useful than an overconfident wrong answer.

But probability output from softmax is not automatically trustworthy uncertainty. Distribution shift can make a model confidently wrong.

4. Recalibration

Methods such as Platt scaling, isotonic regression and temperature scaling can recalibrate predictions using held-out calibration data. That data must be separate from data used to fit the underlying model.

What to Remember

Discrimination asks whether the model ranks cases well; calibration asks whether probability numbers correspond to real frequencies.

Next → Baselines: before celebrating an advanced model, what is the simplest system it must beat?

Six ways to work the chapter, climbing from explaining it in your own words to investigating it like a researcher. Reading is not enough — this is where the chapter lands.

  1. Explain: Distinguish confidence, accuracy and calibration.
  2. Calculate: Compute Brier score for probabilities [0.9,0.7,0.2] and labels [1,0,0].
  3. Predict: Can two models have equal accuracy but different calibration?
  4. Break: Artificially sharpen logits and inspect calibration.
  5. Build: Create a reliability diagram from scratch.
  6. Investigate: Compare uncalibrated and temperature-scaled predictions on held-out data.