Foundations to Frontier
Tests
B. Statistical Learning Theory › B2 Generalization theory

PAC Learning

Probably Approximately Correct (PAC) learning makes 'learning works' a precise mathematical statement: with enough examples, a learner outputs a hypothesis whose error is at most ε, with probability at least 1 − δ, for every data distribution. This topic defines realizable and agnostic PAC learning, sample complexity and consistent learners. It proves sample-complexity bounds for thresholds, axis-aligned rectangles and finite classes, and explains why noise near the decision boundary slows learning. In the research exercise you verify the exact failure law for thresholds and measure learning rates: 1/m without noise or with boundary-jumping (Massart) noise, but about m^(−2/3) when the noise approaches 50% at the boundary.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

A guarantee you can sign

No learner can promise to be exactly right after seeing some examples: it might be unlucky. What it can promise is to be approximately right (error at most ε, say 5%), probably (in at least 95% of the ways the data might have come out), once it has seen enough examples. That’s PAC learning. The theory tells you how many examples is “enough”.

Probably approximately correct: learning a hidden rectangle
this run: error (uncovered area) = 0.0758 > ε ✗
over 300 independent runs: error > ε in 58.7% of them
PAC bound for δ = 0.05: m ≥ (4/ε) ln(4/δ) = 351 (not yet)
Green dots: positive examples; grey: negative. Orange dashed: the unknown target; blue: what the learner outputs. It can only err on the thin strips of the target that no positive example reached. With enough examples, each of the four edge strips is very likely to contain a sample, so the error is small with high probability: Probably Approximately Correct. The guarantee holds for any distribution of examples, not just uniform.
Why engineers care

Certifying a learned component, such as a classifier that flags anomalous telemetry or a perception model on a rover, needs statements of the form “with probability 1 − δ, error ≤ ε”. PAC theory is where those statements come from, and it shows how the required data grows with the target accuracy, the confidence and the richness of the model.

📝 Quick check (Level 0)
0/3 answered
  1. 1. PAC stands for…
  2. 2. In PAC learning, ε controls…
  3. 3. …and δ controls…

Level 1: Beginner

★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.

Definitions

A hypothesis class H is PAC learnable if there is an algorithm A and a function mH(ε,δ)m_H(\varepsilon, \delta) such that for every ε, δ ∈ (0, 1), every distribution D over X, and every target f ∈ H (the realizable case), given m≥mH(ε,δ)m\ge m_H(\varepsilon, \delta) i.i.d. examples labelled by f,

PS∼Dm(err⁡D(A(S))≤ε)≥1−δ.P_{S\sim D^m}\big(\operatorname{err}_D(A(S))\le\varepsilon\big)\ge1 - \delta.

mHm_H is the sample complexity. If A also runs in time polynomial in 1/ε, 1/δ and the input size, H is efficiently PAC learnable (Valiant, 1984).

Thresholds

For f(x)=1[x≥t∗]f(x) = \mathbb 1[x\ge t^*], the consistent learner “smallest positive example” errs by more than ε only if no example lands in the ε-mass interval just above t*. That happens with probability (1−ε)m≤e−εm(1 - \varepsilon)^m\le e^{-\varepsilon m}. So m≥ln⁡(1/δ)/εm\ge\ln(1/\delta)/\varepsilon suffices: 60 examples for ε = δ = 0.05.

📝 Quick check (Level 1)
0/3 answered
  1. 1. The realizable assumption means…
  2. 2. Samples needed for thresholds with ε = δ = 0.05:
  3. 3. PAC guarantees must hold for…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.

Axis-aligned rectangles

The tightest rectangle around the positive examples is consistent and lies inside the target. Its error is the probability mass of the target not covered. Split the target’s border region into four strips, each of mass ε/4. If every strip contains a sample, the error is at most ε. A union bound over the four strips gives failure probability ≤4(1−ε/4)m\le4(1 - \varepsilon/4)^m, so m≥(4/ε)ln⁡(4/δ)m\ge(4/\varepsilon)\ln(4/\delta) suffices (Kearns and Vazirani, 1994): 351 examples for ε = δ = 0.05.

Finite classes

Any consistent learner over a finite H needs only m≥(ln⁡∣H∣+ln⁡(1/δ))/εm\ge(\ln|H| + \ln(1/\delta))/\varepsilon (b2-2).

Agnostic PAC

Drop realizability: labels may be noisy, so the best in class has error min⁡HR>0\min_HR > 0. Require R(A(S))≤min⁡HR+εR(A(S))\le\min_HR + \varepsilon with probability ≥ 1 − δ. For finite classes, ERM needs m=O(ln⁡(∣H∣/δ)/ε2)m = O(\ln(|H|/\delta)/\varepsilon^2). The 1/ε² (instead of 1/ε) is the price of noise in the worst case.

Noise conditions decide the rate

The worst case 1/√m appears when the noise is close to ½ near the decision boundary. If ∣η(x)−12∣≥γ>0|\eta(x) - \tfrac12|\ge\gamma > 0 everywhere (Massart noise), fast 1/m rates return. Intermediate conditions (Tsybakov’s margin condition) give rates in between (Massart and Nédélec, 2006).

🐍 Exercise 1: learning rectangles
Implement the tightest-fit rectangle learner and its exact error under the uniform distribution. Check consistency and that it lies inside the target, then verify the PAC guarantee empirically at m = (4/ε) ln(4/δ), and the failures with far fewer samples.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Rectangle sample complexity:
  2. 2. Agnostic learning over finite H needs about…
  3. 3. Massart noise (η bounded away from ½) allows…

Level 3: Advanced

★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.

Proof: thresholds

Let I be the interval [t∗,t∗+a)[t^*, t^* + a) with probability mass exactly ε. The learner’s error exceeds ε only if no example falls in I, which has probability (1−ε)m≤e−εm(1 - \varepsilon)^m\le e^{-\varepsilon m} (since 1 − x ≤ e^(−x)). Setting that ≤ δ gives m ≥ ln(1/δ)/ε. ∎

Proof: finite realizable classes

A “bad” hypothesis with error > ε is consistent with m random examples with probability (1−ε)m(1 - \varepsilon)^m. By the union bound, some bad hypothesis is consistent with probability ≤∣H∣e−εm\le|H|e^{-\varepsilon m}. Any consistent learner then succeeds with probability ≥ 1 − δ once m≥(ln⁡∣H∣+ln⁡(1/δ))/εm\ge(\ln|H| + \ln(1/\delta))/\varepsilon. ∎

Why the smooth-noise rate is m^(−2/3)

If η(x) = x crosses ½ linearly at t* = ½, then a threshold off by d costs excess risk ∫∣2η−1∣=d2\int|2\eta - 1| = d^2, while the empirical evidence separating t* from t* + d is only about md2md^2. Balancing this against the noise md\sqrt{md} gives d∼m−1/3d\sim m^{-1/3}, so excess risk ∼m−2/3\sim m^{-2/3}.

📝 Quick check (Level 3)
0/3 answered
  1. 1. The key inequality in the threshold proof:
  2. 2. e^(−0.05 · 60) ≈
  3. 3. The finite realizable bound uses a union bound over…

Level 4: Expert

★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.

PAC guarantees, measured

Rectangles. With m = 351 (the ε = δ = 0.05 bound), 0 of 1000 runs exceeded ε = 0.05. The 95th-percentile error was 0.0215, so the bound is about 2.3× conservative. With m/8 = 43 examples, 81% of runs failed.

Thresholds. The simulated failure probabilities match (1 − ε)^m to within 1% at (m, ε) = (50, 0.05) and (100, 0.02).

Rates (mean excess error at m = 25 → 1600):

setting rate (log–log slope)
realizable −1.00
label noise that jumps at the boundary (Massart, η = 0.2/0.8) −0.99
smooth noise, η(x) = x crossing ½ −0.62 (theory −2/3)

Noise far from ½ costs almost nothing; noise near ½ at the boundary is what makes learning slow. For safety-critical classifiers, a clear separation margin is worth more than raw data volume.

🐍 Exercise 2 (research): failure laws and learning rates
Verify the exact failure probability (1 − ε)^m for the realizable threshold learner. Implement exact ERM over thresholds and measure how excess error scales with m in three settings: realizable, Massart noise, and smooth noise crossing ½.

PAC learning in AI, robotics and aerospace

  • Certification: sample-size arguments for validating learned components (how many test scenarios demonstrate a failure rate below ε with confidence 1 − δ).
  • Active learning: querying labels near the boundary can turn 1/ε into log(1/ε) labels for thresholds.
  • Robust learning: noise models (Massart, Tsybakov) and adversarial noise determine what’s achievable.
  • Theory of deep learning: classic PAC bounds are loose for big networks, which motivates B4.

References

  1. L. Valiant (1984). “A theory of the learnable.” Communications of the ACM, 27.
  2. M. Kearns, U. Vazirani (1994). An Introduction to Computational Learning Theory. MIT Press.
  3. S. Shalev-Shwartz, S. Ben-David (2014). Understanding Machine Learning, ch. 2–3. Cambridge.
  4. A. Blumer, A. Ehrenfeucht, D. Haussler, M. Warmuth (1989). “Learnability and the Vapnik–Chervonenkis dimension.” Journal of the ACM, 36.
  5. P. Massart, É. Nédélec (2006). “Risk bounds for statistical learning.” Annals of Statistics, 34.