How do you put confidence intervals on ML metrics?
Written by the mlprep team · Updated
Two models differ by 0.3% AUC or 1% NDCG offline. How do you decide whether that difference is real?
Why point estimates are not enough#
An offline metric is computed on a finite evaluation set. A small improvement may be noise. Senior candidates should ask for uncertainty, not just the metric delta.
Bootstrap#
Bootstrap estimates uncertainty by resampling evaluation examples with replacement, recomputing the metric many times, and taking percentiles of the metric distribution.
For classification, resample examples. For ranking, resample at the query/user/session level, not individual items, because items within a query are correlated.
Paired comparisons#
When comparing two models on the same examples, use paired differences. For each unit, compute metric contribution for model A and model B, then bootstrap the difference. This reduces variance because both models see the same data.
Practical significance#
Statistical significance is not enough. A 0.1% AUC gain may be statistically significant on millions of examples but operationally meaningless. Ask:
- Does it move the product metric?
- Is the lift concentrated in important segments?
- Does it justify added latency or complexity?
- Are guardrails unchanged?
Metric-specific nuance#
AUC has analytic variance estimates, but bootstrap is flexible and works for many metrics. NDCG should be bootstrapped over queries. Calibration metrics should be checked by segment and score bucket because aggregate confidence intervals can hide local failures.
Senior/staff considerations#
The evaluation set itself may be biased. Confidence intervals quantify sampling uncertainty, not label bias, leakage, stale data, or metric misalignment. A tight CI around a biased estimate is still biased.
For launch decisions, combine offline CIs with A/B power analysis. Offline significance does not guarantee online detectability.
The key takeaway unlocks after you reveal an expert answer.
Key Takeaway
Use confidence intervals to separate real metric movement from noise. Bootstrap paired model differences, resampling at the correct unit: examples for classification, queries/users/sessions for ranking. Also check practical significance, segment behavior, and evaluation bias.
Follow-up Questions to Test Yourself
Interviewers often pivot here once you cover the core concept.
- Why should NDCG bootstrap by query instead of item?
- What is the difference between statistical and practical significance?
- Why can a tight confidence interval still be misleading?
How confident do you feel explaining this?
Track your understanding or flag it to revisit before your next loop.
Related Questions