Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Many chances to be fooled
If you test one coin for bias with 100 flips, being badly fooled is rare. If you test a thousand coins, some coin will look biased just by luck. A learner that picks the best of many hypotheses faces the same risk: one of them might look good on the training data by accident. The union bound says the chance that any of them fools you is at most the sum of the individual chances. So the more hypotheses you consider, the more data you need, though only logarithmically more.
Every time you tune hyperparameters, try many models or test many features against the same validation data, you are choosing from a finite class, and the union bound tells you how much your validation score is inflated. It is also why multiple-testing corrections (Bonferroni, a5-1-10) exist.
- 1. The union bound says P(A or B) is at most…
- 2. Choosing among more hypotheses needs…
- 3. Trying 1000 models on one validation set makes the best score…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Two bounds for finite H
- Realizable (some h has zero error): any consistent learner has error ≤ ε with probability ≥ 1 − δ once .
- Agnostic: with probability ≥ 1 − δ, every h satisfies , so ERM is within twice that of the best in class.
Example: conjunctions
Conjunctions of literals over n Boolean variables (like x₀ ∧ ¬x₃ ∧ x₇) number . The elimination algorithm starts with all 2n literals and deletes each one falsified by a positive example. It is consistent, so suffices: 500 examples for n = 20 and ε = δ = 0.05.
- 1. Number of conjunctions over 2 variables (plus 'always false'):
- 2. Realizable sample size grows with |H| as…
- 3. The elimination algorithm learns from…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 35 minUndergraduate students and practising engineers.Occam’s razor
If every hypothesis can be written in b bits, then and . Short descriptions mean few examples are needed (Blumer et al., 1987). A model with 1000 parameters stored as 16-bit numbers is a finite class of size : a valid but loose bound (221 868 examples at ε = δ = 0.05).
The weighted union bound
Assign each hypothesis a prior weight w(h) with (for example from description length). Then, simultaneously for all h with probability ≥ 1 − δ,
Simple hypotheses (large w) get tighter bounds. This works for countably infinite classes too. Structural risk minimization (Vapnik) picks the h minimizing training error plus this penalty, and it is the seed of PAC-Bayes (b2-8).
Looseness
The union bound treats every hypothesis as if its failure were independent of the others. When hypotheses are highly correlated (thresholds, nearby parameters), most of that slack is wasted. Effective class size is what VC dimension and Rademacher complexity measure.
- 1. Occam's bound for b-bit hypotheses:
- 2. In the weighted union bound, a hypothesis with larger prior weight gets…
- 3. The union bound is loosest when hypotheses are…
Level 3: Advanced
★★★★☆ Advanced⏱ 35 minGraduate level, with full derivations and proofs.Proof: agnostic finite class
Hoeffding gives for each h. The union bound over |H| hypotheses gives a total failure probability . Setting this equal to δ and solving for ε gives the formula. ∎
Proof: Occam’s razor
A b-bit description language describes at most 2^b hypotheses; apply the realizable finite-class bound with |H| = 2^b. ∎ Changing the language changes which hypotheses count as “simple”, which is exactly NFL’s inductive bias (b1-5).
Proof: weighted union bound
Give hypothesis h failure budget . Hoeffding at level gives its ε(h), and summing the budgets gives at most δ. ∎
- 1. In the weighted union bound, each h gets failure budget…
- 2. Doubling |H| adds how many samples to the realizable bound at ε = 0.05?
- 3. Bits needed to describe a conjunction over 20 variables:
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Conjunctions and the tightness of the union bound
Conjunctions (n = 20, target x₀ ∧ ¬x₃ ∧ x₇). The elimination algorithm with the Occam size m = 500 never exceeded ε = 0.05 in 200 runs; its mean error was essentially 0, because the bound is very conservative here. With m = 20, 96% of runs had error > ε, as spurious literals survive.
Union-bound tightness (|H| = 1024 hypotheses, m = 200 samples, 10% label noise). The union bound is 0.163. The 95th percentile of the worst gap is:
- 0.137 (84% of the bound) for 1024 random-table classifiers, whose errors are nearly independent;
- 0.097 (60%) for 1024 thresholds, which are highly correlated.
Weighted bound. Coarse thresholds (2 hypotheses at level 1) get ε = 0.113, fine ones (1024 at level 10) get 0.209. The simultaneous violation rate was 0, within the promised δ = 0.05.
Finite classes in AI, robotics and aerospace
- Model selection: hyperparameter search and leaderboard overfitting; the union bound quantifies how much the best validation score is inflated.
- Rule learning: interpretable models (conjunctions, decision lists, small trees) for anomaly detection in telemetry, with Occam-style guarantees.
- Compression-based bounds: quantized and pruned networks give much tighter Occam bounds than raw parameter counts.
- Statistics: Bonferroni and Holm corrections for multiple hypothesis tests (a5-1-10).
References
- A. Blumer, A. Ehrenfeucht, D. Haussler, M. Warmuth (1987). “Occam’s razor.” Information Processing Letters, 24.
- S. Shalev-Shwartz, S. Ben-David (2014). Understanding Machine Learning, ch. 2–4, 7. Cambridge.
- M. Kearns, U. Vazirani (1994). An Introduction to Computational Learning Theory. MIT Press.
- V. Vapnik (1998). Statistical Learning Theory. Wiley.
- W. Zhou, V. Veitch, M. Austern, R. Adams, P. Orbanz (2019). “Non-vacuous generalization bounds at the ImageNet scale: a PAC-Bayesian compression approach.” ICLR.