Evaluation, uncertainty, and calibrated confidence
Measure ranking, decisions, and probability quality separately, with attention to prevalence and sample size.
On this page
The question for today
What you’ll understand
- Compute precision and recall from event counts.
- Distinguish confidence from empirical calibration.
- Evaluate probability quality without reusing the test set for tuning.
An evaluation score answers a particular question. Accuracy evaluates thresholded decisions; ranking metrics ask whether positives tend to outrank negatives; proper probability scores reward honest uncertainty. None alone proves that a model is useful in deployment. A robust evaluation links the metric, test population, operational threshold, and uncertainty to the actual decision the system supports.
Counts explain a threshold's behavior
Count true positives, false positives, true negatives, and false negatives at the chosen threshold. Precision is the fraction of predicted positives that are real positives; recall is the fraction of real positives found. Their denominators answer different questions. A precision score without its count can hide enormous uncertainty, and an undefined ratio when there are no predicted positives should not silently become a successful result. Record the convention used by the reporting implementation.
Prevalence affects interpretation. Even a small false-positive rate can produce many false alarms when negatives greatly outnumber positives. A ranking metric can compare score ordering across thresholds, but deployment still needs a specific action policy. Estimate performance at the intended traffic mix and capacity. Report important slices and uncertainty, especially when examples are clustered by user or incident; a confidence interval that assumes independent rows can be overconfident for strongly correlated observations.
Confidence becomes meaningful through calibration
For binary event probabilities, calibration asks whether outcomes occur about 80% of the time among cases assigned probability 0.8, and analogously elsewhere. One confident correct answer proves little: calibration is a distributional property. Reliability diagrams approximate it by grouping predictions, but bin boundaries and small group counts affect the picture. Calibration within broad bins can also hide failures in particular subgroups, so inspect the intended use rather than trusting one aggregate visualization.
The Brier score averages squared probability errors; log loss also evaluates probabilities and penalizes confident mistakes strongly. These scores reflect more than calibration, including how informative predictions are. A constant base-rate predictor can be calibrated while making little useful distinction between cases. Conversely, a well-ranked model can be systematically overconfident. This separates discrimination, which concerns useful separation, from calibration, which concerns whether stated probabilities match empirical frequencies.
Calibrate and select without contaminating the test
Temperature scaling divides multiclass logits by a positive fitted temperature before softmax. Increasing temperature generally flattens the distribution while preserving the class ordering for each example. Fit the temperature on a held-out calibration set, or within a properly separated development procedure, and assess it on data not used for fitting. It cannot fix every kind of miscalibration, improve the available features, or guarantee calibrated probabilities after a population shift.
Freeze the model, preprocessing, calibrator, and policy before final evaluation. Quantify uncertainty using a method consistent with the sampling unit; for grouped data, resample or analyze groups rather than pretending each row is independent. After deployment, labels may arrive late or only for selected cases, making monitoring biased. Keep the original evaluation report reproducible, document the label window, and treat changes in prevalence or collection as reasons to recheck both threshold performance and probability reliability.
Work it through
Overconfidence can keep the same decisions
Ten independent binary cases all receive probability 0.9 for a positive event, but only six are positive. Compare their empirical Brier score with predicting 0.6 for all ten.
At p=0.9, each of six positives contributes (0.9−1)²=0.01 and each of four negatives contributes 0.9²=0.81.
The mean is (6×0.01+4×0.81)/10=0.33. With p=0.6, it becomes (6×0.16+4×0.36)/10=0.24.
Both predictors classify every case as positive at threshold 0.5, giving 60% accuracy, yet their probability scores differ. This small sample suggests overconfidence but does not precisely identify the population event rate.
The less extreme prediction has the better empirical Brier score, while thresholded accuracy is unchanged. More independent cases are needed for a reliable calibration claim.
The living notebook
Explore the model
Interactive lab · probability
Expected frequency and finite samples
The binomial lab shows exact probabilities for success counts under independent identical Bernoulli trials. Compare its mean with the spread of possible counts; it is not a reliability diagram or a guarantee about heterogeneous model predictions.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA stated probability predicts a distribution of counts; a small observed group can differ from its expectation by chance.
Pause & reason
Check your understanding
Your turn
Try it yourself
At a fixed threshold, a detector finds 30 true positives, produces 10 false positives, and misses 20 positives. Compute precision and recall, then identify the missing information needed to judge whether this is operationally acceptable.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Use predicted-positive and actual-positive denominators separately, then consider consequences.
Compare with the solution
Precision is 30/40=0.75 and recall is 30/50=0.60. Acceptability also needs error costs, event prevalence and traffic volume, capacity for handling alerts, uncertainty in these estimates, and comparison with the existing policy. The two ratios alone cannot decide whether deployment is beneficial.
Keep the idea
Take it with you
- Evaluate the probability, ranking, and action policy as distinct objects.
- Calibration concerns frequencies across comparable predictions.
- Fit calibration on development data and protect final evaluation.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.