advanced29 min studyLesson 752 in Mathematics

PAC learning and uniform convergence

Keep confidence, accuracy, realizability and sampling assumptions visible in finite-class guarantees.

On this page

What you’ll understand

  • State agnostic and realizable PAC guarantees with their distributional quantifiers.
  • Derive a finite-class agnostic guarantee from Hoeffding and a union bound.
  • Compare the distinct inverse-square and inverse-accuracy sufficient sample sizes.

A PAC guarantee fixes an accuracy tolerance and a failure probability, then asks how much independent data suffices uniformly over the allowed populations. It does not say that every training sample works, or that a high-confidence statement assigns a posterior probability to the chosen predictor. Realizable and agnostic learning use different premises, and their finite-class sample bounds reveal why that distinction matters.

Specify what the learner must achieve

In agnostic binary classification, the distribution on labeled examples is arbitrary and the goal is risk within epsilon of the best rule in a fixed hypothesis class. The learner must meet this goal with probability at least one minus delta over its independent training sample, for every allowed distribution. In the realizable setting, a class member has zero population error. A consistent learner then returns a class member with zero training error, but the premise of a zero-risk class member remains essential to the faster argument.

Classes and losses must be fixed independently of the sample used in the theorem. A class chosen after inspecting labels is not automatically covered by a bound that counts only its final size. The learner’s internal randomness, if any, must also be included in the probability space or handled by a conditioning argument. We use finite nonempty classes and measurable deterministic tie breaking for the explicit bounds, avoiding subtleties about measurable suprema and existence of minimizers.

PS ⁣(RP(A(S))≤inf⁡h∈HRP(h)+ε)≥1−δfor every allowed P\mathbb P_S\!\left(R_P(A(S))\le\inf_{h\in H}R_P(h)+\varepsilon\right)\ge1-\delta\qquad\text{for every allowed }P
This agnostic guarantee compares to the fixed class; probabilities are over an iid sample and any explicitly included algorithmic randomness.↔ Scroll wide equations horizontally.

Uniform convergence handles sample-dependent selection

For any one fixed predictor with loss in[0,1], Hoeffding bounds the probability that its empirical and population risks differ by more than a. A union bound over M predictors gives a simultaneous event. The events for different predictors need not be independent: each predictor’s loss sequence is iid across examples, and the union bound needs no independence across predictors. Exact empirical minimization then has class excess at most twice a on that event by the deterministic comparison already established.

Set a equal to epsilon divided by two and solve for n. The resulting sufficient bound grows like log(M/delta) divided by epsilon squared. It is a guarantee from a particular proof, not a claim that its numerical constant is optimal or that every dataset needs that many observations. If the bound is much larger than an available sample, the calculation is inconclusive rather than proof that learning cannot work. Empirical performance and an absent certificate are different statements.

P ⁣(sup⁡h∈H∣RP(h)−R^S(h)∣>a)≤2Me−2na2,n≥2log⁡(2M/δ)ε2\mathbb P\!\left(\sup_{h\in H}|R_P(h)-\widehat R_S(h)|>a\right)\le2M e^{-2na^2},\qquad n\ge\frac{2\log(2M/\delta)}{\varepsilon^2}
For finite M, iid examples and losses in[0,1], the sample-size condition certifies epsilon excess for exact ERM.↔ Scroll wide equations horizontally.

Consistency permits a different realizable proof

In the realizable binary setting, a hypothesis with population error greater than epsilon is consistent on n independent examples with probability at most (1−ε)n(1-\varepsilon)^n, bounded by e−nεe^{-n\varepsilon}. A union bound over all bad hypotheses shows that n at least log(M/delta) divided by epsilon suffices for every consistent class member to have small true error. This argument uses actual zero-one errors and consistency, rather than a two-sided uniform approximation of all risks.

The inverse-accuracy bound should not be used for noisy data merely because an expressive class interpolates its training sample. Interpolation is a fact about observed labels, whereas realizability asserts that some rule in the predetermined class makes no errors on the entire population. Enlarging the class until it fits every sample may simultaneously increase its complexity. The sample-size comparison below therefore compares two theorems under different assumptions, not two interchangeable formulas for the same unrestricted problem.

The same finite class under two sets of assumptions

For M=100 fixed binary hypotheses, epsilon=0.10 and delta=0.05, compute sufficient sample sizes for the displayed agnostic ERM bound and the realizable consistent bound.

  1. For agnostic ERM, use n≥2log⁡(2⋅100/0.05)/(0.10)2=200log⁡4000≈1658.80993n\ge2\log(2\cdot100/0.05)/(0.10)^2=200\log4000\approx1658.80993.

  2. Round upward to 1659 observations. This makes the simultaneous deviation event strong enough to give class excess at most 0.10 with confidence at least 0.95.

  3. Under the additional realizability premise, consistency instead needs n≥log⁡(100/0.05)/0.10=10log⁡2000≈76.0090n\ge\log(100/0.05)/0.10=10\log2000\approx76.0090, so 77 observations suffice for that separate theorem.

The result

Sufficient sizes are 1659 in the agnostic argument and 77 in the realizable argument. Zero training error alone does not justify choosing the smaller number.

Explore the model

Interactive lab

Interactive lab · probability

A bad rule can accidentally fit a sample

Pause and Reset, then set error probability p = 0.10 and trials n = 20. Predict that a fixed rule with true error 0.10 makes no sample errors with probability 0.9²⁰≈0.1216, despite positive risk. Reset and set both p = 0.10 and n = 30: predict zero-error probability 0.9³⁰≈0.0424. The bars concern one fixed rule; they do not union-bound an adaptive search or simulate a realizable target.

A bad rule can accidentally fit a sampleThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forConsistency on finitely many examples is compatible with positive population error.

Check your understanding

When is the finite-class log(M/delta)/epsilon consistency guarantee justified?

Try it yourself

Repeat both sufficient-size calculations for M=20, epsilon=0.20 and delta=0.10. State the roles of epsilon and delta.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Use natural logarithms and round the final sample sizes upward, rather than rounding the logarithm first.

Compare with the solution

The agnostic bound is 2log⁡400/(0.20)2=50log⁡400≈299.5732\log400/(0.20)^2=50\log400\approx299.573, so n=300 suffices. The realizable bound is log⁡200/0.20=5log⁡200≈26.4916\log200/0.20=5\log200\approx26.4916, so n=27 suffices under realizability and consistency. Epsilon controls the allowed excess or classification error; delta controls how often the guarantee may fail over independently drawn samples. A confidence of 0.90 does not assert that each individual prediction is correct with probability 0.90, and it does not change the reference class against which excess risk is measured.

Take it with you

  • PAC quantifiers range over populations and random training samples.
  • Finite-class uniform convergence supports sample-dependent ERM selection.
  • The faster consistency bound requires population realizability rather than observed interpolation alone.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.