Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.An estimate, not a fact
When a paper reports that model B beats model A by 2.3 points, the number depends on which test examples happened to be drawn and which seeds happened to train the models. A confidence interval says how far the true difference could plausibly be from the estimate. It is honest only if it includes every source of variation that matters: here both the test set and the seeds.
True accuracy difference 0.023; 200 independent experiments on 1,000 test examples. Share of nominal 95% intervals containing the truth:
An interval from one seed covers only the test-set noise and misses the truth about a third of the time.
In Exercise 2, an interval from one seed per model, bootstrapped over test examples, contained the true difference in 68.5% of 200 experiments, not 95%; five seeds per model with a bootstrap over seeds and examples contained it in 93.5%.
- 1. A 95% confidence interval should contain the true value in about…
- 2. Accuracy differences vary with…
- 3. An interval from a single seed ignores…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Sources of variance: sampling of test examples; training randomness (initialisation, data order, augmentation, dropout); hyperparameter search.
- Standard deviation vs standard error: the spread of individual runs vs the uncertainty of their mean (sd/√n).
- Confidence interval: a range built so that, over repeated experiments, it contains the true value at the stated rate; t-intervals for a few seeds, bootstrap intervals by resampling.
- Paired tests: McNemar’s test on the examples where the two models disagree; paired t-tests across seeds or datasets.
- Coverage: the share of repeated experiments whose interval contains the truth.
- Practical significance: whether a difference is large enough to matter, judged against a margin set in advance; equivalence tests (TOST) show a difference is smaller than the margin.
- 1. The standard error of a mean of n runs is…
- 2. McNemar's test uses…
- 3. An equivalence test shows…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Intervals that cover the truth
Exercise 1.
- Test examples have standard normal difficulties; a model is right when its skill plus a seed shift (sd 0.06) plus example-level seed noise (sd 0.5) exceeds the difficulty.
- Skills 1.0 and 1.1 give true accuracies 0.8141 and 0.8371 over the population and seeds: a true difference of 0.0230.
- Exercise 1 evaluates five seed pairs on one test set of 1,000 and computes a paired bootstrap interval.
Practice.
- Run several seeds per model (5 or more) and pair them where possible.
- Resample what varies: seeds and test examples, with a bootstrap over both, or a t-interval over seeds each on its own data split.
- Report intervals, not just means, and say what the error bars are.
- Use paired tests (McNemar, paired t) on the same test set.
- Fix a margin of practical importance before looking at the results.
d = b - a # seeds x examples, correctness
s = randint(0, seeds, (B, seeds)) # resample seed pairs
idx = randint(0, n, (B, n)) # resample test examples
boot = d[s[:, :, None], idx[:, None, :]].mean((1, 2))
lo, hi = percentile(boot, [2.5, 97.5])- 1. With 3 seeds, the t-interval in Practice 1 was about…
- 2. Mean ± standard error contained the truth in Practice 3 in about…
- 3. A 0.2-point gain on a million test examples was…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Two sources of variance. The measured difference D = true difference + test-set error + seed error. With one seed per model, a bootstrap over examples estimates only the test-set part σ_t²; if the seed part is σ_s², the interval’s half-width is about 1.96σ_t and its coverage is P(|Z| ≤ 1.96σ_t/√(σ_t² + σ_s²)), below 95% whenever σ_s > 0.
Paired differences on one test set. If n10 examples are right only for B and n01 only for A, McNemar’s statistic is (n10 − n01)/√(n10 + n01). With shares p10 and p01, the paired difference has variance (p10 + p01 − (p10 − p01)²)/n, much smaller than the unpaired 2p(1 − p)/n when the models agree on most examples.
Standard deviation bars. A mean of n runs has standard error σ/√n, so a bar of ±σ is √n standard errors wide and covers the truth with probability about P(|Z| ≤ √n): 97.5% for n = 5. A bar of ±σ/√n covers only about 68% (less with few runs).
Equivalence. The two one-sided tests at 5% conclude that the difference lies within ±m exactly when the 90% confidence interval lies inside (−m, m).
- 1. A ±1 standard deviation bar over 5 runs covers the true mean with probability about…
- 2. McNemar's statistic with 70 and 40 discordant examples is about…
- 3. TOST at 5% is equivalent to checking that…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.How often does each common way of putting an interval on an accuracy difference contain the true difference?
History.
- W. S. Gosset (“Student”, 1908) derived the t-distribution for small samples; B. Efron (1979) introduced the bootstrap.
- Q. McNemar (1947) proposed the paired test for proportions; T. Dietterich (1998) compared statistical tests for classifiers and recommended McNemar and the 5×2 cross-validation test; J. Demšar (2006) set out tests over multiple datasets.
- D. Schuirmann (1987) formalised the two one-sided tests for equivalence.
- R. Agarwal and colleagues (2021) showed that deep reinforcement learning results with few runs needed interval estimates; X. Bouthillier and colleagues (2021) measured the variance of machine-learning benchmarks.
Exercise 2.
- 200 independent experiments, each with a fresh test set of 1,000 examples and fresh seeds; true difference 0.0230.
- Intervals: paired bootstrap over test examples for one seed pair; t-interval over 5 seed pairs on the same test set; bootstrap over the 5 seed pairs and the test examples together (300 resamples each).
Seed 0:
| interval | coverage | mean width | excludes zero |
|---|---|---|---|
| one seed, bootstrap over examples | 68.5% | 0.0438 | 56.5% |
| 5 seeds, t-interval over seeds | 92.5% | 0.0514 | 45.5% |
| 5 seeds, bootstrap over seeds and examples | 93.5% | 0.0424 | 59.5% |
Seeds 1 and 2: coverage 60.5% and 66.5% (one seed), 94.5% and 94.0% (t-interval), 94.0% and 94.0% (two-level bootstrap).
Findings.
- One seed gave intervals that missed the truth 31% to 40% of the time, in all seeds, while looking as narrow as the honest ones.
- Five seeds brought coverage to 92% to 95%; the bootstrap over seeds and examples was the narrowest honest interval.
- Coverage slightly below 95% comes from percentile bootstrap and t-intervals with only five seeds; more seeds bring it closer.
Statistical rigor in practice
- Report means with intervals over at least 5 seeds; state what the error bars are (standard deviation, standard error or confidence interval).
- Use paired comparisons: the same test set, the same seeds and data splits where possible (topic O2-4).
- For many datasets or tasks, report per-task results and use tests across tasks (Demšar 2006) or robust aggregates such as the interquartile mean with stratified bootstrap intervals (rliable).
- Decide in advance what difference matters, and say when a significant gain is too small to matter.
References
- B. Efron (1979). “Bootstrap methods: another look at the jackknife.” Annals of Statistics.
- Q. McNemar (1947). “Note on the sampling error of the difference between correlated proportions or percentages.” Psychometrika.
- T. G. Dietterich (1998). “Approximate statistical tests for comparing supervised classification learning algorithms.” Neural Computation.
- J. Demšar (2006). “Statistical comparisons of classifiers over multiple data sets.” Journal of Machine Learning Research.
- R. Agarwal, M. Schwarzer, P. S. Castro, A. Courville and M. G. Bellemare (2021). “Deep reinforcement learning at the edge of the statistical precipice.” NeurIPS.