The interview problem
A model always predicts 0.5 on a balanced binary dataset and appears perfectly calibrated. Another model predicts 0.1 or 0.9, but the corresponding observed positive rates are 0.2 and 0.8. Which has the lower Brier score? Explain calibration, resolution and the limits of a binned decomposition.
Original ML-fundamentals practice, not a reported company interview. Numerical examples are hypothetical. Primary software documentation retrieved September 27, 2026; interview date not applicable.
1. State the scoring convention
For binary labels yᵢ in {0,1} and predicted positive probabilities pᵢ, use BS=(1/n)Σ(pᵢ−yᵢ)². Lower is better; this binary convention ranges from zero to one. A multiclass score that sums squared errors across all classes has a different scale, so record the convention before comparing numbers.
If the true conditional positive probability is q, expected squared loss at prediction p is q(p−1)²+(1−q)p²=(p−q)²+q(1−q). It is uniquely minimized at p=q. This establishes strict propriety for the binary probability forecast under the specified distribution. It does not mean a finite test set's minimum identifies the true probabilities without estimation error.
2. Compare calibration with resolution numerically
Take 100 examples, split into two groups of 50. The low-risk group has ten positives and forty negatives; the high-risk group has forty positives and ten negatives. Overall prevalence is 0.5. Model A predicts 0.5 everywhere, giving squared error 0.25 on every example and BS=0.25.
Model B predicts 0.1 for the low-risk group and 0.9 for the high-risk group. In the low group, loss sum is 10×0.9²+40×0.1²=8.5; the high group also contributes 8.5. Thus BS=17/100=0.17. B is miscalibrated in both groups, but its score is better than A's because it separates groups with different outcome rates.
Model C predicts 0.2 and 0.8 for those groups. Its low-group loss is 10×0.8²+40×0.2²=8, with the same total in the high group, giving BS=0.16. These empirical frequencies exactly calibrate C on this constructed dataset; using them to fit and evaluate a real calibrator on the same data would be optimistic.
3. Decompose forecasts that are constant within groups
Suppose each forecast group k has a single probability pₖ, count nₖ and observed event rate oₖ. Let o be the overall rate and wₖ=nₖ/n. The exact empirical decomposition is BS=REL−RES+UNC, where REL=Σwₖ(pₖ−oₖ)², RES=Σwₖ(oₖ−o)² and UNC=o(1−o).
To derive the identity, expand the mean squared loss inside a constant-forecast group as (pₖ−oₖ)²+oₖ(1−oₖ). Averaging the second term gives o(1−o)−Σwₖ(oₖ−o)², yielding REL−RES+UNC. For forecast reliability, groups should be defined by the forecast value rather than by inspecting outcomes; arbitrary outcome-based subdivisions can inflate apparent resolution.
Reliability REL is the squared discrepancy between forecasts and group frequencies; smaller is better. Resolution RES measures how much those frequencies differ from the overall rate; larger reduces loss. Uncertainty UNC is the empirical binary variance of the outcome, shared when models use the same evaluation population and weights.
For B, REL=0.5×0.1²+0.5×0.1²=0.01. RES=0.5×0.3²+0.5×0.3²=0.09 and UNC=0.25. Therefore BS=0.01−0.09+0.25=0.17. For C, reliability becomes zero while resolution and uncertainty stay unchanged, yielding 0.16. A has one forecast group, zero empirical reliability error and zero resolution, yielding 0.25.
This explains why a lower Brier score does not by itself demonstrate better calibration. Scikit-learn's calibration documentation explicitly distinguishes these contributions. A constant base-rate forecast can be calibrated while offering no separation among examples.
4. Do not claim exactness from arbitrary bins
In practice, continuous predictions are often placed into bins and summarized by their mean probability. If forecasts vary within a bin, the three-term computation above is exact for the coarsened predictor that assigns the bin mean to every member, not generally for the original predictions. Within-bin variation and its association with outcomes have been discarded.
For a two-example counterexample, predictions are 0.1 and 0.9 and outcomes are zero and one. Original Brier loss is 0.01. Put both into one bin: mean probability and event rate are both 0.5, so binned REL=0, RES=0 and UNC=0.25. The binned decomposition gives 0.25, not 0.01. It describes a different predictor.
Report exact unbinned loss alongside diagnostic reliability plots, bin counts and the binning policy. More bins reduce coarsening but increase estimation noise. Grouping every distinct probability separately can produce singleton groups with outcome rates zero or one; the empirical decomposition may still be algebraically exact while its components are poor estimates of population reliability and resolution.
5. Compare against an honest reference
A Brier skill score can be defined as 1−BS_model/BS_reference, provided the reference loss is positive. Against A's 0.25, B's skill is 1−0.17/0.25=0.32 and C's is 0.36. These express relative loss reduction under this reference, not classification accuracy or a fraction of correctly calibrated predictions.
For operational evaluation, choose the reference forecast without looking at future test labels, such as a historical prevalence estimate. The test-set prevalence is useful for describing uncertainty in the decomposition, but using it as an allegedly deployable baseline leaks outcome information. Scores from different prevalence distributions are not directly comparable without discussing the population shift.
With a 1% positive rate, a constant 0.01 forecast has expected Brier loss 0.01×0.99=0.0099. Its small raw score does not prove useful rare-event detection. Compare to a meaningful baseline, inspect rare-event slices and measure decision utility at the relevant costs and capacities.
6. Build a reproducible comparison
frozen models + untouched labeled evaluation population
↓
exact per-example squared probability losses
↓
paired loss differences + design-aware uncertainty
↓
reliability diagnostics + resolution + subgroup checks
↓
decision utility and release judgmentUse identical examples and label availability rules across models. For paired comparisons, retain each example's loss difference and resample at the independent unit, such as user or document. A numerical improvement without uncertainty may be sampling noise. Repeatedly tuning calibration on the acceptance set undermines the comparison.
When applying weights, define the target population and use normalized nonnegative weights consistently in both the score and diagnostics. The unweighted example does not justify mixing weighted loss with unweighted calibration plots. Check label quality and missing-label selection; a proper scoring rule cannot repair systematically biased labels.
Inspect calibration and Brier loss by operationally relevant slices. Opposite calibration errors can cancel in a coarse aggregate. Report uncertainty for small slices instead of declaring perfect calibration from a handful of outcomes. A model can have a better probability score yet worse utility for a specific threshold or constrained action policy.
7. Follow-ups and self-review
Follow-ups: Does perfect calibration imply useful discrimination? No. Does lower Brier loss prove lower reliability error? No. Does an arbitrary binned decomposition exactly recover raw loss? Not generally. Is a skill score always defined? No, a zero reference loss makes the ratio undefined. Does strict propriety eliminate finite-sample uncertainty? No.
Score 0–2 each for score convention, expected-loss derivation, worked decomposition, binning counterexample and honest baseline/uncertainty. A strong answer separates probability accuracy from calibration alone.
Sources and next steps
- Scikit-learn: probability calibration — Brier reliability, resolution and uncertainty; documentation publication date not established.
The numerical examples, finite-group derivation and binning counterexample are original. Continue with label-shift correction for probability changes under different class priors.
Continue your preparation
Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.