SStatistics, Built

Stage IV · PhD Core

Part 54 of 65

Statistical Learning Theory

PhDstarts at this level49 min of film12 chaptersprerequisites: Part 34, Part 48, Part 51

Why does fitting data generalize at all, and why do interpolating models seem to break the theory?

In Moscow in 1971 Vapnik and Chervonenkis ask when the empirical risk converges to the true risk uniformly over a class of rules, and answer with shattering: half-planes realize 14 of the 16 labellings of four points in a square. The part turns Part 48's uniform laws into the risk of the rule that was chosen. Empirical risk minimization, PAC learning and the no-free-lunch theorem set the problem; VC bounds are proved by symmetrization and Sauer-Shelah, and Rademacher complexity with the contraction lemma sharpens them for linear and kernel classes. Localization explains why the excess risk falls like 1/n while the deviation falls like one over root n. Margins account for AdaBoost improving on the breast cancer data after its training error reaches zero; PAC-Bayes bounds a Gibbs posterior, stability bounds ridge and SGD, and Hedge and the bandit algorithms give regret bounds that convert to batch guarantees. Calibrated surrogates justify minimizing a convex loss. The part ends where the theory strains: min-norm interpolators show double descent and benign overfitting, and Nagarajan and Kolter show that uniform convergence cannot explain it.

What you need. Part 48's empirical processes (symmetrization, VC classes, chaining), Part 51's concentration, and Part 34's predictive methods as things to be explained.

Hook
Vapnik & Chervonenkis, 1971
Mathematics
uniform convergence, VC and Rademacher, localization, margins, PAC-Bayes, stability, online learning, calibrated surrogates, benign overfitting
Built
statkit.slt

What you will be able to do

Bachelor's

  • Explain shattering by counting the labellings a class of rules can produce on a few points, and why a class that can produce all of them learns nothing from them.

Master's

  • Compute VC, Rademacher and finite-class bounds for a given class and sample size, and compare them with a simulated uniform deviation.
  • Run Hedge and UCB1 and compare their regret with the bounds.

PhD

  • Prove the VC bound by symmetrization and the Sauer-Shelah lemma, and the Rademacher bound with the contraction lemma.
  • Prove a PAC-Bayes bound and a uniform-stability bound, and say which property of the algorithm each uses in place of the size of the class.
  • State the benign-overfitting conditions and why a uniform-convergence bound can be vacuous for an interpolator that generalizes.

Practice

  • Report the error of a model chosen among many with a holdout or a bound uniform over the candidates, never a Wald interval on its training error.
  • Read a boosting run by its margin distribution as well as its training error.

Contents

Each chapter has a home level. Choose a track to see what to read and watch: Bachelor's 6 min · Master's 10 min · PhD 49 min · Practice 10 min.

  1. 0Vapnik and Chervonenkis, 1971Bachelor's4 min
  2. 1ERM and uniform convergencePhD5 min
  3. 2VC boundsPhD5 min
  4. 3Rademacher complexityPhD4 min
  5. 4Localization and fast ratesPhD4 min
  6. 5MarginsPractice4 min
  7. 6PAC-BayesPhD4 min
  8. 7StabilityPhD4 min
  9. 8Online learningPhD5 min
  10. 9Classification-calibrated surrogatesPhD3 min
  11. 10InterpolationPhD5 min
  12. Recap, problems, and the road aheadAll tracks2 min

Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.

Lecture

The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.

Vapnik and Chervonenkis, 1971Bachelor's4 min

Moscow, 1971. Vladimir Vapnik and Alexey Chervonenkis, working on pattern recognition, asked a question that became the foundation of learning theory. Suppose you choose, from some class of rules, the one with the fewest mistakes on your sample. When will its error on new data be close to its error on the sample? The rule was chosen because it did well on this sample, so the question must be answered for all rules in the class at once: uniformly. Their answer turned on a single combinatorial number: how many different ways the class can label a set of points.

The idea, drawn with this part's instrument, the shatterer. Three points in the plane, and the class of half-planes: a rule labels a point one if it lies on one side of a line. Gold points are labelled one, blue rings zero. All eight ways of labelling three points can be produced by some half-plane. We say the class shatters the three points: on them it can fit anything, so a perfect fit tells you nothing.

Four points are different. Put them at the corners of a square and label the diagonals alike. No line separates one diagonal from the other: the exclusive-or pattern that once stalled the perceptron. Of the sixteen labellings of these four points, half-planes produce . No set of four points in the plane can be shattered by half-planes, so their Vapnik–Chervonenkis dimension is three: the size of the largest set the class can fit in every possible way.

Counting the labellings half-planes produce on random points, by brute force. Up to three points, all of them. Beyond, far fewer: on nine points, of the possible. Norbert Sauer and Saharon Shelah proved in 1972, as Vapnik and Chervonenkis had, that a class of VC dimension d produces at most the sum of n choose i for i up to d labellings: a polynomial in n. Polynomially many effective rules instead of exponentially many is exactly what lets a union bound work, and that is why learning from a sample is possible at all.

The questions of this part. How far can the sample error be from the true error, uniformly over a class of rules? When does the gap shrink like one over n rather than one over the root of n? Why do boosting, wide margins and averaged posteriors generalize, even when the classes involved are huge? And why do modern models that fit the noise in their training data exactly sometimes still predict well, which the classical theory seems to forbid?

Three promises come due. Part forty-eight built uniform laws and VC classes for their own sake; chapters one to four apply them to the rule you actually chose. Part thirty-four made predictions with guarantees, by experiment; chapters five to nine explain why learning algorithms generalize. And Part fifty-three's Gibbs posteriors get their risk bounds in chapter six, from PAC-Bayes.

Numbers: half-planes on n random points: 2, 4, 8, 14, 22, 32, 44, 58, 74 labellings (2ⁿ = 512 at n = 9; Sauer's bound 130); four points in a square: 14 of 16

1ERM and uniform convergencePhD5 min

Empirical risk minimization and uniform convergence: why the chosen rule's sample error lies. Take an independent, identically distributed sample and a fixed measurable class of rules. For the classification bounds here, losses lie between zero and one. True risk is expected loss on a new observation; empirical risk averages the observed losses. Empirical risk minimization chooses a rule with the smallest sample risk. This creates optimism in expectation: the chosen rule tends to look better on its training sample. It is not a pointwise inequality on every dataset.

The excess risk over the best possible, the Bayes risk, splits in two: estimation error, how far the chosen rule is from the best in the class, and approximation error, how far the class's best is from the best overall. Adding and subtracting empirical risks bounds the estimation error by twice the largest gap between empirical and true risk over the whole class. So the programme is to control that uniform deviation: then minimizing the empirical risk is safe. And class size trades the two errors off against each other, Part nineteen's bias–variance trade-off in its most general form.

The simplest class: thresholds on the unit interval, with ten percent of labels flipped at random, two hundred data sets at each size. The VC bound in purple, and the thinner expectation bound below it. This is not another ninety-five percent confidence bound. The actual uniform deviation, in teal, falls with slope : one over root n, as the theory says. But ERM's excess risk, in gold, falls with slope , much faster: one over n. The uniform deviation is a worst case over all thresholds, and the chosen one is not the worst; chapter four explains the gap. The VC bound is valid at every n, and about ten times too large.

For a class of K rules fixed before the data, bounded losses let Hoeffding control each rule. A union bound makes the failure probability at most two K times e to the minus two n t squared. Inverting gives the displayed simultaneous confidence bound. Only log K enters, a mathematical form of Occam's razor. Infinite classes require a ghost-sample symmetrization argument before counting label patterns. We cannot simply substitute the observed number of patterns into this finite-class formula.

The same questions in the language of computer science. In the realizable case, some rule in the class makes no mistakes at all. Then about d over epsilon times log one over epsilon examples suffice for ERM's error to be below epsilon with high probability, as Anselm Blumer and colleagues proved in 1989. With label noise, the agnostic case, the number grows to d over epsilon squared: a whole power of epsilon worse, the slow rate of chapter one. Leslie Valiant's probably-approximately-correct framework of 1984 added the requirement that learning run in polynomial time, which makes it a theory of algorithms as well as of samples.

And without restricting the class, nothing can be learned. The no-free-lunch theorems, in David Wolpert's form, say that for every learning algorithm there is a distribution on which it does badly. A class of infinite VC dimension cannot be learned uniformly over distributions at any rate. So the class plays the role a prior plays for a Bayesian: it is what you are willing to assume. The fundamental theorem of statistical learning says a binary class is learnable, in the distribution-free sense, exactly when its VC dimension is finite.

When the right class size is unknown, Vapnik's structural risk minimization uses a nested sequence of classes of growing capacity. It minimizes the empirical risk plus a penalty for the class's complexity, of order the root of its VC dimension over n. The result satisfies an oracle inequality: it does almost as well as if the best class had been known in advance, trading approximation against estimation automatically. In practice the penalty is usually replaced by cross-validation, Part twenty-eight's method, which estimates the same trade-off from the data.

Numbers: thresholds, n = 25 → 1,600: excess risk 0.039 → 0.0006 (realizable), 0.050 → 0.0026 (η = 0.4); uniform deviation 0.17 → 0.021

2VC boundsPhD5 min

VC bounds: from counting labellings to a guarantee. The ghost sample controls deviation through a probability symmetrization inequality, with constants and a small-deviation condition; the first row is a schematic, not a pathwise comparison. Conditional on the combined two n observations, only finitely many binary loss patterns matter. A union bound, together with random swaps, then gives the growth-function tail bound. Sauer and Shelah bound the growth function by the sum of binomial coefficients up to d. For one at most d at most n, this is bounded by e n over d to the d; when d exceeds n use two to the n.

The result: with probability one minus delta, the uniform deviation is at most the root of eight times d log of two e n over d plus log four over delta, over n. Its rate is the root of d log n over n, and Part forty-eight's chaining removes the log. Its great strength is that it holds for every distribution. Its weakness is the same thing: most distributions are not the worst case, so it is usually loose, as chapter one's chart showed.

Matching lower bounds describe the worst distribution for each learner, not the risk on every distribution. Take a binary class with VC dimension at least two. In the agnostic case, the expected excess risk can be at least a constant times the minimum of one and root d over n. In the realizable case the analogous rate is the minimum of one and d over n. Shattered sets provide hard instances, using Part fifty's lower-bound methods. Thus VC dimension characterizes distribution-free sample complexity, with logarithmic qualifications for particular upper bounds.

Why does the growth function turn polynomial? Here is the proof of the Sauer–Shelah lemma, by induction on n. Forget the last point: labellings of the n points that differ only at that point merge in pairs. So the count of labellings of n points is the count on n minus one points, plus the number of merged pairs, those patterns that extend both ways. The class of merged pairs has VC dimension at most d minus one: if it shattered a set, then that set plus the last point would be shattered by the original class, impossible for a set of size d plus one. Apply the induction to both terms, and Pascal's rule for binomial coefficients assembles the sum of n choose i for i up to d: at most e n over d to the power d.

Some VC dimensions. Thresholds on the line, one; intervals, two; half-planes, three, as in the hook; half-spaces in p dimensions, p plus one; axis-aligned rectangles, four. The VC dimension is not the number of parameters: the one-parameter class of sine waves has infinite VC dimension, because a high enough frequency can fit any labelling of suitably placed points. And neural-network VC bounds depend on depth and activation as well as weight count. For certain ReLU architectures, an upper bound is of order W L log W. Such worst-case capacity can greatly exceed the sample size.

For classes of real-valued functions, such as regression rules, the VC dimension is replaced by its scale-sensitive cousins, David Pollard's pseudo-dimension and the fat-shattering dimension. They bound covering numbers in the empirical L-two metric, as David Haussler showed. And Dudley's entropy integral from Part fifty-one turns covering numbers into a Rademacher bound. The unifying idea of all these measures: capacity is the number of genuinely different functions the class contains at each resolution.

What the Board says. An error estimated on the same data used to choose the rule is biased, often badly. A uniform bound pays for the size of the whole class, and is honest. An independent holdout removes selection bias; its interval method still determines coverage and width. Cross-validation, Part twenty-eight's subject, sits in between.

Numbers: VC bound 1.72 → 0.26, Rademacher bound 1.16 → 0.20 for d = 1; union half-width 0.163 for K = 1,000, n = 200; Board as above

3Rademacher complexityPhD4 min

Rademacher complexity: how well can a class fit pure noise? Draw independent random signs. Empirical Rademacher complexity is the expected largest signed correlation that the class can achieve on the observed points. It measures the ability to fit noise on these data. Symmetrization controls the expected one-sided supremum of population minus sample risk by twice the expected complexity. For an absolute supremum one must use the appropriate absolute or enlarged loss class. The distinction matters even for a singleton class, whose one-sided Rademacher complexity is zero.

For a fixed measurable class with losses in zero to one, this bound holds simultaneously for all rules with probability one minus delta. It adds empirical loss, twice the empirical complexity of the loss class, and a concentration term. A finite bounded class has complexity at most root two log K over n. For binary VC classes, chaining removes the elementary counting bound's logarithm. The empirical complexity adapts to the sample's geometry, but the probability guarantee still needs the concentration term.

The contraction lemma of Michel Ledoux and Michel Talagrand makes this practical: composing with an L-Lipschitz loss multiplies the Rademacher complexity by at most L, so the loss can be peeled off. For linear functions with weights of norm at most B, Cauchy–Schwarz and Jensen give B times the root of the summed squared norms of the data, over n. For a ball in a reproducing-kernel space, the same with the trace of the kernel matrix. Neither bound involves the dimension: only the norm of the weights and the size of the data, which is why kernel methods in infinite-dimensional feature spaces can generalize.

The link to chapter two is Pascal Massart's finite-class lemma: for a finite set of vectors of norm at most r, the expected maximum correlation with random signs is at most r times the root of two log the set's size, over n. Each correlation is sub-Gaussian by Part fifty-one, and the maximum of finitely many sub-Gaussians is controlled by the log of their number. For a binary VC class with one at most d at most n, the vectors are the class's labellings of the sample, at most e n over d to the d of them, which gives a Rademacher complexity of the root of two d log of e n over d, over n. Counting labellings and fitting noise are the same idea.

Rademacher complexities computed by simulation over two thousand sign vectors, for data in ten dimensions. The linear class with weights of norm one, in blue, falls with slope . The trace bound, in purple, is almost exactly its value: for linear classes, Jensen's inequality loses very little. A ball in a Gaussian-kernel space, in gold, behaves the same way. Both shrink like one over the root of n.

Norm bounds propagate through a network under assumptions on the input radius and the activation's Lipschitz constant. Bartlett, Foster and Telgarsky give a margin bound involving the product of operator norms, divided by the margin and root n, and additional layer terms. This is a margin generalization term, not the unscaled function complexity. Other bounds avoid an explicit width factor when specified norms stay controlled. The norms themselves can grow with width. These are useful structural results, but their numerical values can remain vacuous for trained networks.

Why Rademacher complexity became the standard tool. It adapts to the geometry of the data at hand, not just the class. It handles real-valued losses through contraction. It composes: the complexity of a convex hull equals that of the class, and deep networks can be bounded layer by layer through their weight norms. And it is the engine of the margin bounds of chapter five and the localization of chapter four.

Numbers: linear class 0.221 → 0.034 (bound 0.225 → 0.036); Gaussian kernel 0.200 → 0.035 (bound 0.200 → 0.035) for n = 25 → 800

4Localization and fast ratesPhD4 min

Localization and fast rates: when the gap shrinks like one over n. Chapter one's puzzle: the uniform deviation falls like one over root n, but the excess risk of the chosen rule fell like one over n. The reason is that the chosen rule lies near the best one, and near the best rule the excess losses have small variance. If the variance of the excess loss is at most a constant times its mean, a Bernstein condition, then Bernstein's inequality applied to a shrinking neighbourhood gives an excess risk of order d log n over n. Peter Bartlett, Olivier Bousquet and Shahar Mendelson's local Rademacher complexities of 2005, and Vladimir Koltchinskii's work of 2006, made this the general method.

The excess risk of ERM over thresholds at three noise levels. With no noise, the realizable case, the slope is : one over n. With ten percent of labels flipped, : still one over n. With forty percent flipped, the curve sits higher, with a slope of over this range, and tends to the same rate. Here the Bayes threshold belongs to the class. With noise bounded away from a half, the Bernstein condition holds and the rate is fast; only the constant, one over one minus two eta, grows as the labels become nearly random.

Massart noise bounds the conditional label probability away from a half. If the Bayes classifier belongs to the VC class, this gives the displayed fast rate, with confidence and complexity terms understood. Tsybakov's condition limits the mass near the decision boundary. For suitable classes containing the Bayes rule, it gives the displayed exponent, with class-dependent factors. Kappa zero yields the worst-case square-root rate. A fixed positive noise gap yields the Massart regime. Under misspecification the same conclusion needs an appropriate Bernstein condition around the best rule in the class.

This second-moment Bernstein condition, with beta between zero and one, controls excess losses by their mean. It is stronger than merely bounding the variance. At beta one, Bernstein concentration and localization can yield fast rates. The concentration inequality alone does not supply the class's local complexity. With VC-type entropy, the schematic rate interpolates between fast and slow as beta varies. Examples include bounded squared-loss regression under suitable convexity and noise assumptions, classification with a Bayes rule in the class and Massart noise, and suitably bounded log loss. None holds without regularity conditions.

Apply local complexity to the star hull of excess losses around the optimal rule. A sub-root upper bound absorbs the Bernstein constants. Its positive fixed point identifies the relevant scale. This is not an arbitrary raw class with an arbitrary fixed point. Under the boundedness, Bernstein and empirical-process assumptions, an excess-risk bound is of order that radius plus the confidence term. A VC-type entropy upper bound gives a fast-rate radius of order d times a logarithm over n, capped in the appropriate regime; some classes admit sharper rates.

In well-specified squared-loss regression, with the regression function in the class, excess risk equals squared L-two distance to that function. For a misspecified convex projection there is an additional nonnegative cross term. Under bounded or sub-Gaussian design and noise assumptions, suitable localized and multiplier-process bounds define a critical radius. The squared error is then controlled by a constant times the radius squared. For a one-dimensional Sobolev ball this recovers n to the minus two s over two s plus one. In input dimension d, the denominator becomes two s plus d.

Numbers: excess risk slopes ≈ −1 against the deviation's −½, for noise 0, 0.1 and 0.4

5MarginsPractice4 min

Margins: why boosting kept improving after it stopped making mistakes. AdaBoost combines weak rules, reweighting examples according to their exponential losses. A naive bound that counts all votes with T terms becomes weaker as T grows; it does not predict that actual test error must rise. In several early experiments, test error kept falling after training error reached zero. Margin bounds explain how this can happen: normalized voting margins can improve while the base class stays fixed. They need not improve monotonically, and boosting can overfit noisy labels.

Real data: the Wisconsin breast cancer biopsies, for training and for testing. AdaBoost with decision stumps on the thirty features, for four hundred rounds. The training error, in teal, reaches zero at round . The test error, in blue, is at that point and after four hundred rounds. more stumps added to a vote that already fits the training data perfectly, and the test error did not rise.

The margins themselves: the cumulative distribution of the normalized vote margin over the training points. After five rounds, some margins are negative, mistakes, the smallest . After fifty, every point is correct, and the smallest margin is . After four hundred, . The bottom of the distribution moves to the right, even as the top comes in: boosting keeps working on the examples it is least sure of, pushing their votes away from the decision boundary at the expense of the easy ones.

Fix a positive margin level gamma before the sample. The bound holds simultaneously over normalized convex combinations of bounded weak rules. An expected Rademacher term and a confidence term control the ramp loss. Selecting gamma afterwards requires a uniform-in-gamma argument and its extra penalty. A convex hull has the same Rademacher complexity as its base class, so the normalized vote count does not enter directly. Large sample margins can therefore certify small test error, though the displayed right side can be vacuous. Breiman showed that maximizing only the smallest margin can hurt; the whole margin distribution matters.

Statisticians read AdaBoost differently. Jerome Friedman, Trevor Hastie and Robert Tibshirani showed in 2000 that it is coordinate descent on the exponential loss, summed over the training set. The population minimizer of that loss is half the log-odds of the class probability, so boosting is fitting an additive logistic model. Friedman's gradient boosting of 2001 generalizes it to any loss, fitting each new tree to the negative gradient. And in practice its complexity is controlled by shrinkage and early stopping, a form of the stability of chapter seven.

Hard-margin support vector machines choose a largest-margin separating hyperplane when the data are separable. Radius and margin must be normalized together. Capacity bounds can depend on their squared ratio rather than the ambient dimension. Thus infinite-dimensional kernels can generalize when norms, radii and margins are controlled; the kernel trick by itself does not prevent overfitting. Soft-margin methods also pay for violations. The useful insight is to measure effective capacity rather than count parameters alone.

A sample compression scheme uses a fixed reconstruction map, a selected subset of s examples, and any declared finite side information. If the reconstructed rule is consistent on the remaining independent examples, a union bound gives the displayed risk bound, with additional cost for side information or choosing the size. For a feasible hard-margin SVM with a uniquely specified solution and suitable treatment of degeneracies, support vectors determine the rule. Deleting a non-support vector changes nothing. The leave-one-out error on n observations bounds the expected risk of the algorithm trained on n minus one, not on n.

Numbers: breast cancer, 340 train / 229 test: tie-safe stumps: zero training error at round 9; test error 0.0742 at round 9 → 0.0437 at round 400; minimum margin −0.178 (5), 0.178 (50), 0.215 (400)

6PAC-BayesPhD4 min

PAC-Bayes: bounds for averaged rules, with a prior. Take independent data, losses in zero to one, and a prior fixed independently of this sample. After seeing it, choose a posterior. The risk here is the Gibbs risk: average loss when a classifier is drawn from that posterior. It is not automatically the risk of a deterministic majority vote. With probability one minus delta, the binary KL bound holds simultaneously for all posteriors. Pinsker's inequality gives the simpler square-root version. These statements permit posterior and temperature selection on the same sample, because the event is already simultaneous.

The proof is four lines. The Donsker–Varadhan variational formula bounds any posterior expectation by the KL divergence plus the log of the prior expectation of an exponential. Take the exponent to be n times the binary KL between empirical and true risk: for each fixed rule its exponential moment is at most two root n, by Andreas Maurer's calculation. Since the prior does not depend on the data, Markov's inequality controls the prior average of that exponential. And the binary KL is convex, so Jensen moves the posterior average inside.

A test: a hundred and one threshold rules, a uniform prior over them, five hundred noisy examples. The posterior is a Gibbs posterior, the prior reweighted by e to the minus lambda times the empirical risk, Part fifty-three's object. As lambda grows, the posterior concentrates on the empirically best rules: its empirical risk, in teal, and true risk, in blue, both fall. The PAC-Bayes bounds in purple trade the falling empirical risk against the rising KL divergence; the tighter one is lowest, , at lambda . The red line is the classical guarantee for ERM, a union bound over the hundred and one rules: . The averaged rule's bound is a little better, and the true risk is .

The trade-off in numbers. As lambda rises, the KL divergence from the uniform prior grows, the empirical risk falls, and the bound is smallest in between. The KL divergence can never exceed log a hundred and one, four point six two, reached when the posterior is a point mass: then PAC-Bayes reproduces the union bound's log K. Averaging over several good rules buys a smaller KL, and a better bound.

A Gibbs posterior exactly minimizes a linear empirical-risk-plus-KL objective. It need not minimize the displayed nonlinear KL bound at a fixed temperature. Here lambda multiplies n times empirical risk; the preceding chart used lambda times empirical risk, so its temperature parameter is n times this one. Natural-log likelihood loss at lambda one yields the ordinary Bayesian posterior. The optimum variational objective equals minus log marginal likelihood. But log loss can be unbounded: applying a PAC-Bayes generalization theorem to evidence requires its own exponential-moment or model assumptions. Evidence alone is not a certificate from the bounded-loss theorem.

PAC-Bayes is flexible because the reference prior need only be independent of the evaluated sample. A prior learned from separate data is allowed. Data-dependent choices on the same sample require a different bound or an explicit cost. Flatness helps find a spread-out posterior with low empirical loss, but does not by itself imply small KL: the reference prior and parameter scaling matter. Dziugaite and Roy constructed non-vacuous neural-network bounds by controlling both terms. Catoni developed related Gibbs estimators and bounds under explicit loss assumptions.

Numbers: 101 thresholds, n = 500, noise 0.15: best kl bound 0.211 (λ = 200, true risk 0.155) vs union bound 0.221; McAllester 0.234

7StabilityPhD4 min

Stability: generalization from the algorithm, not the class. A different route to generalization looks at the algorithm instead of the class. An algorithm is beta-uniformly stable if replacing any one training point changes the loss of its output on any example by at most beta. Olivier Bousquet and André Elisseeff showed in 2002 that the expected gap between true and empirical risk is then at most beta: and with McDiarmid's inequality, a high-probability bound, useful when beta is of order one over n. An algorithm that does not depend much on any single example cannot overfit any single example.

Ridge regression is the model case. Its objective is lambda-strongly convex, so replacing one of n points moves the minimizer by at most a constant over lambda n. Its stability is therefore of order L squared R squared over lambda n, with R the data's radius: stable at the rate one over n. Larger lambda buys more stability at the price of more bias, the same trade-off in a new language.

Here the design and responses are bounded. For each dataset we refit twenty sampled neighbouring datasets, and measure the largest squared-loss change on two thousand validation points. Purple averages that sampled diagnostic over ten datasets. It is not the supremum defining uniform stability. Blue shows the average test-minus-training loss, with negative values retained on this signed axis. Both tend to shrink as regularization increases, but the theorem does not force the observed gap to track this diagnostic. Monte Carlo standard errors and a conservative theoretical uniform bound are retained with the numerical inputs.

Pure differential privacy bounds output probabilities under replacement of one record by a factor e to epsilon. For independent data and losses in zero to one, it yields an expected generalization-gap bound of order e to epsilon minus one, useful for small epsilon. It is distributional stability, not a claim that coupled outputs are always close. Private mechanisms can also help control adaptive reuse of a holdout. Dwork and colleagues' reusable holdout needs a specified mechanism, accuracy and query budget, and privacy accounting. Repeated arbitrary access is not made safe by the name alone.

Stability can exploit the training algorithm. For convex Lipschitz smooth losses, suitable step sizes and independent uniform index sampling, the expected stability of coupled SGD is controlled by the summed step sizes over n. This is an expectation over algorithmic randomness. Early stopping limits that upper bound; it does not prove that every later iterate generalizes worse. Some nearest-neighbour or bagged procedures admit other forms of stability under distributional assumptions. Ordinary one-nearest-neighbour is not uniformly stable in general. Appropriate stability assumptions also support leave-one-out risk estimation.

Here is the theorem at work. Run stochastic gradient descent for logistic regression on two samples of two hundred that differ in a single point, with the same independent uniform index stream, averaged over forty coupled runs, and measure how far apart the two parameter vectors drift. With step size a fifth, the divergence after ten epochs is . With step size one, it is . The dashed lines bound the expected divergence over algorithmic randomness. They are not pathwise bounds, two times the step size times the number of steps over n: under the bounded logistic smoothness conditions, and loose in this example. The bound grows with every step; the real divergence levels off after an epoch or two, because the data's curvature keeps pulling the two runs together, which a worst-case argument cannot see. What the bound does get right is the larger step's larger price, and that without strong convexity, it is the number of steps that must be limited: early stopping.

Numbers: bounded ridge, n = 200, p = 50: sampled loss changes 0.1316 → 0.000492 and signed gap 0.04695 → −0.002540 over λ = 10⁻³ → 3 (10 datasets); SGD divergence after 10 epochs 0.16 (η = 0.2; bound 4) and 0.27 (η = 1; bound 20)

8Online learningPhD5 min

In expert advice, choose a distribution over experts before observing the round's bounded loss vector. Losses may be adversarial. Our displayed Hedge guarantee uses the mixture's linear loss. If an expert is sampled instead, one needs a non-anticipating adversary for the corresponding expected-loss interpretation. Regret compares cumulative mixture loss with the best single expert in hindsight. The aim is sublinear regret, so average excess loss tends to zero. The adversary may use the past, but cannot see the current sampled action and then target that action under the standard randomized guarantee.

Hedge, the exponential-weights algorithm of Freund and Schapire, weights each expert by e to the minus eta times its cumulative loss. A potential-function argument bounds its regret by log K over eta, plus eta T over eight. With eta tuned, the regret is at most the root of T log K over two: sublinear in T, and only logarithmic in the number of experts. No algorithm can do better against every sequence, up to constants, as Nicolò Cesa-Bianchi and Gábor Lugosi's book proves. And Hedge is AdaBoost's ancestor: boosting is Hedge played over training examples.

Hedge over fifty experts for five thousand rounds. The losses are random, with one expert slightly better on average. The regret, in gold, ends at . The bound, in purple, log K over eta plus eta t over eight, holds at every round and ends at , with room to spare. Per round, the regret is : Hedge is almost exactly as good as the best expert, without knowing which one it is. This calculation uses the mixture loss, not a sampled action path.

Bandit feedback reveals only the selected arm's loss. For a non-anticipating adversary, EXP3 achieves expected regret of order root T K log K, capped by T. Minimax optimal algorithms remove the extra logarithm. For stationary independent stochastic arms, UCB1 has logarithmic instance-dependent regret when gaps are fixed. Lai and Robbins' lower bound has distribution-dependent KL constants, not simply inverse gaps in every model. It is an asymptotic statement for uniformly efficient algorithms, not a finite-round lower envelope for the plotted paths. Exploration trades immediate reward against information.

Five slot machines, with success rates from seven tenths down to three tenths, played for fifty thousand rounds, regret averaged over ten runs. Epsilon-greedy explores at random a tenth of the time, forever, so its regret grows linearly, to ; on the log scale it bends upward. EXP3, designed for an adversary, pays for its caution, ending at . UCB1 explores only arms whose upper confidence bound is still competitive, and its regret grows like log T: a straight line on this scale, ending at . The asymptotic Lai and Robbins reference, in purple, is also logarithmic; UCB1 matches its rate, with a larger constant. Suitable KL-UCB or Thompson-sampling algorithms achieve the asymptotic instance constant under additional assumptions; this line is not a finite-time lower bound.

To convert online learning to a statistical result, feed independent observations sequentially, so each predictor is chosen before its next observation. For a convex loss, average iterates; for arbitrary expert classifiers, use their randomized mixture. Jensen's inequality or linearity then bounds expected excess risk by expected regret over n. Hedge recovers the finite-class square-root rate for the mixture, not automatically for a deterministic majority vote. With bounded domain and gradients, online gradient descent similarly gives a stochastic optimization rate of one over root n.

Online convex optimization uses convex losses on a convex feasible set. With bounded diameter and gradient norms, projected gradient descent and a suitable step size give root T regret. Convexity alone is insufficient. Uniform strong convexity, bounded gradients and a decreasing step schedule can improve it to log T. Mirror descent changes the geometry: exponential weights uses negative entropy on the simplex, while ordinary projected gradient descent uses squared Euclidean distance.

Numbers: Hedge, K = 50, T = 5,000: regret 51.7 vs bound 98.9; bandits, T = 50,000: ε-greedy 1,193, EXP3 962, UCB1 269, Lai–Robbins 75

9Classification-calibrated surrogatesPhD3 min

Classification-calibrated surrogates: why minimizing the wrong loss is safe. Zero-one loss is discontinuous; minimizing it over general families can be computationally hard. A step loss alone does not imply every class is hard. Many methods instead optimize a convex surrogate such as hinge loss. The blue logistic loss is in bits, using log base two, consistently with its psi transform. Exponential loss gives boosting. Squared margin loss is another surrogate. These losses upper-bound the displayed step with the chosen scaling, but optimization and statistical consistency are separate questions.

Binary classification calibration means that restricting a conditional score to the wrong sign increases the best attainable surrogate risk. For convex margin losses, calibration is equivalent to differentiability at zero with negative derivative there; differentiability is part of the condition. The psi inequality compares with the unrestricted measurable-score optimum. In a restricted model, approximation error must also be accounted for. Vanishing unrestricted surrogate excess implies vanishing classification excess. Merely minimizing within a misspecified class does not ensure Bayes consistency.

The psi functions themselves. For the hinge loss, psi of theta is the absolute value of theta: linear, so a surrogate excess of epsilon means a classification excess of at most epsilon. For the squared and exponential losses, psi is quadratic near zero, and so is the logistic loss's. A quadratic psi means the classification excess is at most a loss-dependent constant times the root of the surrogate excess: still consistent, but with a slower translation of rates, unless a noise condition from chapter four improves it.

A Tsybakov noise condition can improve the conversion from surrogate excess to classification excess. For the quadratic calibration behaviour of squared, logistic or exponential loss, suitable conditional curvature bounds yield the displayed exponent. It is not a universal formula for every calibrated loss. Without a noise condition the conversion is square root; under a fixed Massart gap it can be linear. Hinge already has a linear conversion without this improvement. These compare with unrestricted optima. Learning rates still require controlling approximation, optimization and surrogate estimation errors.

A strictly proper probability loss uniquely minimizes conditional expected loss at the true class probability. Logistic margin loss is proper composite: its score is the log odds, and the inverse link converts it to a probability. A finite sample or misspecified model need not be calibrated in probability. Hinge minimization primarily identifies a class sign; an SVM score is not itself a probability. Platt scaling can estimate a link on separate data, without an automatic calibration guarantee. Cost-sensitive decisions need suitable probability estimates or a method designed for the relevant decision threshold.

With more than two classes, care is needed. Some natural multiclass versions of the hinge loss are not calibrated, as Ambuj Tewari and Bartlett showed in 2007. The multinomial logistic loss, cross-entropy, is. It also estimates the class probabilities themselves, not just the labels, which connects it to Part thirty-four's calibration. That is one reason deep networks are trained with cross-entropy.

Numbers: ψ(θ) = |θ| (hinge), θ² (squared), 1 − √(1 − θ²) (exponential)

10InterpolationPhD5 min

Interpolation: double descent and benign overfitting. Zhang and colleagues showed that some image networks can fit random training labels. For a class of binary predictions that realizes all sign patterns, the empirical Rademacher complexity is maximal. Random-label fitting alone says nothing universal about a norm-restricted score class. The same training procedure can generalize on real labels, showing that unrestricted capacity can be an uninformative upper bound. Fitting noisy observations exactly is interpolation. Overfitting concerns prediction risk; the two are not definitions of the same event.

Double descent, the phenomenon Mikhail Belkin and colleagues named in 2019. Least squares on the first p of a thousand features, a hundred observations, and when p exceeds n the minimum-norm interpolating solution. With few features, the classical picture: risk at ten, rising as the fit grows noisier. At p equal to n, the interpolation threshold, the design is barely invertible and the population mean excess risk is infinite. The finite twelve-dataset average happens to be about . Beyond it, a second descent. The dashed curve is the exact expected excess risk away from the singular range; it breaks at the threshold. Among the many interpolating solutions the minimum-norm one spreads the noise across many directions, and the risk falls to with a thousand features. Here the best point among these finite-draw averages is one that fits the training data exactly.

In suitable random-design linear models, a few strong directions may carry signal while a long tail absorbs noise. Whether minimum-norm interpolation generalizes depends on signal alignment as well as covariance geometry. Bartlett, Long, Lugosi and Tsigler give bias and variance bounds involving an index selected through effective-rank conditions. The displayed expression is schematic and needs their design and noise assumptions. Small bias, k over n tending to zero, and n over the tail effective rank tending to zero can make excess risk vanish. A large tail rank alone is not an if-and-only-if characterization.

A four-dataset-per-cell illustration, with stored Monte Carlo errors. Five strong features carry the signal, plus twenty thousand tiny ones. Every numerical fit is checked to interpolate its training data exactly, noise and all, yet the excess risk falls from at fifty observations to at four hundred, far below the noise level of a quarter. With a short tail of only four hundred features, the same interpolation at two hundred observations has excess risk , as large as the noise itself: harmful overfitting. Same signal, same algorithm: the spectrum of the features decides.

The phenomenon is not special to linear models. Tengyuan Liang and Alexander Rakhlin showed in 2020 that kernel regression with no ridge penalty interpolates and can still generalize in high dimension. Mikhail Belkin, Rakhlin and Alexandre Tsybakov built interpolating nearest-neighbour-style rules, with singular weights, that are statistically consistent. And gradient descent on least squares, started from zero, converges to exactly the minimum-norm interpolator of the double-descent chart. The algorithm, not an explicit penalty, decides which interpolator is found: its implicit bias is the real regularizer.

Vaishnavh Nagarajan and Zico Kolter argued in 2019 that uniform convergence itself may be unable to explain these successes. They built settings, overparameterized linear classifiers trained by gradient descent, where the uniform deviation over any class containing the learned rules is close to one, though the learned rules generalize well. Even the tightest uniform bound, tailored to the algorithm, is then vacuous. What explains the successes instead is the implicit bias of the algorithm, which picks particular interpolators like the minimum-norm one, and exact high-dimensional asymptotics, the subject of Part fifty-nine.

Where learning theory stands. In classical regimes, VC dimension, Rademacher complexity, margins, PAC-Bayes and stability give sharp and useful guarantees. For heavily overparameterized models, what matters is the algorithm's implicit bias and the geometry of the data, alongside the effective capacity used by the algorithm. A theory of deep learning's generalization as clean as Vapnik's remains open. And the practical rule is unchanged by any of it: estimate the risk on data you did not use to choose, as the Board showed in chapter two.

Numbers: min-norm least squares, n = 100: 12-dataset mean latent excess risk 1.14 (p = 10), 1,392 (p = n), 0.925 (p = 1,000); population mean is infinite at p = n−1, n, n+1; benign excess 0.191 → 0.013 for n = 50 → 400; short tail 0.246

Recap, problems, and the road aheadAll tracks2 min

Part fifty-four in eleven lines. Vapnik and Chervonenkis's shattering. Empirical risk minimization and uniform convergence. VC bounds, and selection on the Board. Rademacher complexity and contraction. Localization and fast rates. Margins for boosting and support vector machines. PAC-Bayes and Gibbs posteriors. Stability, for ridge regression and stochastic gradient descent. Online learning and regret. Calibrated surrogate losses. And double descent with benign overfitting.

A promise for the next part. This one explained why learning generalizes, and where the classical theory runs out. It and the eleven parts before it were taken one at a time. Part fifty-five is the qualifying exam: twelve classic problems that draw on the whole PhD core at once, each posed, paused and proved on screen.

Where it comes back. Part fifty-five sets a learning-theory problem in the qualifying exam. Part fifty-seven returns to distribution-free guarantees with conformal methods. Part fifty-eight turns online learning into betting and e-values. Part fifty-nine computes the exact risks of interpolators when p and n grow together. And Part sixty-four asks what any of this says about foundation models.

Six problems, with full solutions in the README. Two VC dimensions; the finite-class bound; the linear class's Rademacher complexity; the realizable threshold's fast rate; Hedge's regret; and the hinge loss's psi-transform. Pause here if you want to try them.

The books this part follows: Shalev-Shwartz and Ben-David, Bach's Learning Theory from First Principles, Mohri, Rostamizadeh and Talwalkar, Wainwright, Vapnik's own book, and Cesa-Bianchi and Lugosi on prediction and games; with the papers from Vapnik and Chervonenkis to Bartlett, Long, Lugosi and Tsigler.

Fifty-four parts of sixty-five, and the courses of the PhD core are complete. Generalization depends on the learning rule, the data distribution and the capacity it effectively uses. Uniform bounds are one route; margins, stability, PAC-Bayes and the geometry of interpolation give others. Independent evaluation remains essential when choosing among models. Next, Part fifty-five: the qualifying exam.

Where it goes next. The qualifying exam follows (Part 55). Distribution-free conformal guarantees are Part 57, online learning becomes betting and e-values in Part 58, the exact risks of interpolators in proportional asymptotics are Part 59, and the generalization of foundation models is Part 64.

Key results

The part's results in one place, for revision.

ERM and uniform convergence\(\displaystyle R(\hat h)-\inf_{h\in\mathcal H}R(h)\ \le\ 2\sup_{h\in\mathcal H}|R_n(h)-R(h)|\)
Sauer-Shelah\(\displaystyle \Pi_{\mathcal H}(n)\ \le\ \sum_{i=0}^{d}\binom ni\ \le\ \Bigl(\frac{en}{d}\Bigr)^d\qquad\allowbreak (n\ge d=\operatorname{VC}(\mathcal H))\)
The Rademacher bound\(\displaystyle \sup_{f\in\mathcal F}\bigl(\operatorname{E}f-\operatorname{E}_nf\bigr)\le2\mathfrak R_n(\mathcal F)+\sqrt{\frac{\log(1/\delta)}{2n}},\qquad\allowbreak \hat{\mathfrak R}_n\bigl(\{x\mapsto\langle w,x\rangle:\|w\|\le B\}\bigr)\le\frac{B}{n}\sqrt{\sum_i\|x_i\|^2}\)
PAC-Bayes (the kl form)\(\displaystyle \operatorname{kl}\bigl(R_n(\rho)\,\|\,R(\rho)\bigr)\ \le\ \frac{\operatorname{KL}(\rho\,\|\,\pi)+\log(2\sqrt n/\delta)}{n}\quad\allowbreak \text{for }\allowbreak \text{all }\rho\text{, }\allowbreak \text{with }\allowbreak \text{probability }1-\delta\)
Hedge\(\displaystyle \text{regret}_T\ \le\ \sqrt{\tfrac12T\log K}\qquad\allowbreak (K\text{ experts, }\allowbreak \text{losses }\allowbreak \text{in }[0,1],\ \text{tuned }\allowbreak \text{learning }\allowbreak \text{rate})\)
Calibrated surrogates (Bartlett, Jordan and McAuliffe)\(\displaystyle \psi\bigl(R(f)-R^*\bigr)\ \le\ R_\phi(f)-R_\phi^*,\qquad\allowbreak \psi(\theta)=|\theta|\ \text{(hinge)},\ \ \theta^2\ \text{(squared)}\)

Try it

Lab 54 · Uniform deviations, ERM's excess risk, and the best of a thousand classifiers

For threshold classifiers with 10% label noise, measure the uniform deviation sup |R_n - R| and the excess risk of the empirical risk minimizer as n grows, against the VC and Rademacher bounds. Then pick the best of 1,000 coin-flipping classifiers on 200 points and see which interval for its true error still covers.

Figure produced by Lab 54: Uniform deviations, ERM's excess risk, and the best of a thousand classifiers
Produced by the lab below, seed 0, in 0.3 s.
python -m videos.stats.labs 54 needs numpy, scipy, matplotlib · download lab54.py · source on GitHub
n = 25: mean sup|R_n - R|, mean excess risk of ERM    0.1748, 0.0435   Rademacher bound 1.162   VC bound (95%) 1.725
n = 100: mean sup|R_n - R|, mean excess risk of ERM   0.0905, 0.0111   Rademacher bound 0.670   VC bound (95%) 0.924
n = 400: mean sup|R_n - R|, mean excess risk of ERM   0.0456, 0.0028   Rademacher bound 0.374   VC bound (95%) 0.491
n = 1600: mean sup|R_n - R|, mean excess risk of ERM  0.0220, 0.0008   Rademacher bound 0.205   VC bound (95%) 0.259
fitted exponents in n: deviation, excess risk         -0.50, -0.98   (theory -1/2 and, with bounded noise, -1)
best of 1,000, n = 200: Wald on the training error    covers 0.0%   (nominal 95%)
best of 1,000, n = 200: Hoeffding + union bound       covers 99.8%   (nominal 95%)
best of 1,000, n = 200: Wald on a fresh holdout       covers 94.8%   (nominal 95%)
its mean training error against its true error        0.376 vs 0.49   union half-width 0.163

Uniform convergence explains why ERM works and its bounds hold, loosely; the excess risk itself falls faster than the deviation. After choosing among many rules, only a bound uniform over the class, or fresh data, gives an honest error bar.
The code (82 lines; it asserts its own result)
"""Lab 54: uniform convergence for thresholds, the fast rate of ERM, and what selection does to an error bar."""

import numpy as np

from videos.coursekit import labs
from explainer.stats.kit import slt

TITLE = "Uniform deviations, ERM's excess risk, and the best of a thousand classifiers"
GOAL = ("For threshold classifiers with 10% label noise, measure the uniform deviation sup |R_n - R| and the excess "
        "risk of the empirical risk minimizer as n grows, against the VC and Rademacher bounds. Then pick the best of "
        "1,000 coin-flipping classifiers on 200 points and see which interval for its true error still covers.")
TASKS = [
    "Raise the label noise eta to 0.4. Does the excess risk still fall like 1/n, or closer to 1/sqrt(n) at these "
    "sample sizes?",
    "Change K from 1,000 to 10 and to 100,000. How does the optimism of the selected classifier grow with K, and how "
    "does sqrt(log K) compare?",
    "Replace the union bound by a kl PAC-Bayes bound (slt.gibbs_posterior, slt.kl_discrete, slt.pac_bayes_bounds) "
    "for a Gibbs posterior over the 1,000 classifiers.",
]


def run(seed=0):
    rng = np.random.default_rng(seed)
    lab = labs.Lab()
    eta, reps = 0.1, 300
    ns = [25, 100, 400, 1600]
    dev, exc, q95 = [], [], []
    for n in ns:
        d, e = [], []
        for _ in range(reps):
            x, y = slt.threshold_data(n, rng, eta=eta)
            d.append(slt.uniform_deviation_threshold(x, y, eta=eta))
            e.append(float(slt.threshold_risk(slt.erm_threshold(x, y), eta=eta)) - eta)
        d, e = np.array(d), np.array(e)
        assert np.all(e <= 2 * d + 2e-3), "excess risk of ERM is at most twice the uniform deviation"
        dev.append(d.mean())
        exc.append(e.mean())
        q95.append(np.quantile(d, 0.95))
        lab.row(f"n = {n}: mean sup|R_n - R|, mean excess risk of ERM",
                f"{dev[-1]:.4f}, {exc[-1]:.4f}   Rademacher bound {slt.rademacher_vc_bound(n, 1):.3f}   "
                f"VC bound (95%) {slt.vc_bound(n, 1):.3f}")
        assert dev[-1] < slt.rademacher_vc_bound(n, 1) and q95[-1] < slt.vc_bound(n, 1), "the bounds hold"
    s_dev = np.polyfit(np.log(ns), np.log(dev), 1)[0]
    s_exc = np.polyfit(np.log(ns), np.log(exc), 1)[0]
    lab.row("fitted exponents in n: deviation, excess risk", f"{s_dev:.2f}, {s_exc:.2f}   (theory -1/2 and, with bounded noise, -1)")
    assert -0.6 < s_dev < -0.4 and s_exc < -0.8, "the deviation is slow, the excess risk is fast"

    # selection: K classifiers whose errors are independent coin flips with true error 0.49
    K, n, r, trials = 1000, 200, 0.49, 400
    z = 1.959964
    union = slt.finite_class_bound(n, K)
    best = rng.binomial(n, r, size=(trials, K)).min(axis=1) / n  # the lowest training error
    wald = z * np.sqrt(best * (1 - best) / n)
    hold = rng.binomial(n, r, size=trials) / n  # the selected classifier on fresh data
    cover = {"Wald on the training error": float(np.mean(np.abs(best - r) <= wald)),
             "Hoeffding + union bound": float(np.mean(np.abs(best - r) <= union)),
             "Wald on a fresh holdout": float(np.mean(np.abs(hold - r) <= z * np.sqrt(hold * (1 - hold) / n)))}
    for k, v in cover.items():
        lab.row(f"best of {K:,}, n = {n}: {k}", f"covers {v:.1%}   (nominal 95%)")
    lab.row("its mean training error against its true error", f"{best.mean():.3f} vs {r}   union half-width {union:.3f}")
    assert cover["Wald on the training error"] < 0.02, "the naive interval ignores the selection"
    assert cover["Hoeffding + union bound"] > 0.95 and abs(cover["Wald on a fresh holdout"] - 0.95) < 0.05
    lab.note = ("Uniform convergence explains why ERM works and its bounds hold, loosely; the excess risk itself falls "
                "faster than the deviation. After choosing among many rules, only a bound uniform over the class, or "
                "fresh data, gives an honest error bar.")

    fig, ax = labs.figure(2, size=(11, 4.2))
    ax[0].loglog(ns, dev, "o-", color=labs.BLUE, label=f"mean sup|R_n - R|  (slope {s_dev:.2f})")
    ax[0].loglog(ns, exc, "o-", color=labs.GOLD, label=f"mean excess risk of ERM  (slope {s_exc:.2f})")
    ax[0].loglog(ns, [slt.rademacher_vc_bound(n, 1) for n in ns], color=labs.MUTED, ls="--", label="Rademacher bound")
    ax[0].loglog(ns, [slt.vc_bound(n, 1) for n in ns], color=labs.RED, ls="--", label="VC bound, 95%")
    ax[0].set(title="Thresholds with 10% label noise", xlabel="n", ylabel="risk")
    ax[0].legend(loc="lower left")
    bins = np.arange(0.3475, 0.56, 0.005)
    ax[1].hist(best, bins=bins, color=labs.RED, alpha=0.65, label="training error of the selected classifier")
    ax[1].hist(hold, bins=bins, color=labs.GREEN, alpha=0.55, label="its error on a fresh holdout")
    ax[1].axvline(r, color=labs.INK, ls="--", label="its true error 0.49")
    ax[1].set(title="The best of 1,000 coin-flipping classifiers, n = 200", xlabel="error rate", ylabel="trials")
    ax[1].legend(loc="upper left")
    ax[1].set_ylim(0, ax[1].get_ylim()[1] * 1.45)
    lab.fig = fig
    return lab

Now change it

  1. Raise the label noise eta to 0.4. Does the excess risk still fall like 1/n, or closer to 1/sqrt(n) at these sample sizes?
  2. Change K from 1,000 to 10 and to 100,000. How does the optimism of the selected classifier grow with K, and how does sqrt(log K) compare?
  3. Replace the union bound by a kl PAC-Bayes bound (slt.gibbs_posterior, slt.kl_discrete, slt.pac_bayes_bounds) for a Gibbs posterior over the 1,000 classifiers.

Problems, with solutions

Try each problem before opening its solution.

  1. Two VC dimensions. Show that intervals on \(\mathbb R\) have VC dimension 2, and half-planes in \(\mathbb R^2\) have VC dimension 3.

    Solution
    • Intervals shatter two points a < b: ∅, {a}, {b} and {a, b} are each cut out by an interval. For three points a < b < c, the labelling (+, −, +) needs an interval containing a and c but not b, which is impossible. So the VC dimension is 2.
    • Half-planes shatter any three points not on a line: every subset of a triangle's vertices is separated from the rest by a line. For four points, either one lies inside the triangle of the others (it cannot be labelled differently from all three) or they form a convex quadrilateral (the two diagonals' labelling, + − + − around the hull, cannot be separated: Radon's theorem). So the VC dimension is 3.
  2. The finite-class bound. Prove the finite-class bound \(\sup_h|R_n - R| \le \sqrt{\log(2K/\delta)/(2n)}\) from Hoeffding and a union bound.

    Solution
    • For each h, Hoeffding gives P(|R_n(h) − R(h)| > t) ≤ 2e^{−2nt²}.
    • A union bound over K rules gives P(sup_h |R_n − R| > t) ≤ 2Ke^{−2nt²}.
    • Set this to δ and solve: t = √(log(2K/δ)/(2n)).
  3. Linear classes. Show \(\hat{\mathfrak R}_n\{x \mapsto \langle w, x\rangle: \|w\| \le B\} \le B\sqrt{\sum\|x_i\|^2}/n\).

    Solution
    • sup_{‖w‖≤B} ⟨w, Σσᵢxᵢ⟩/n = B‖Σσᵢxᵢ‖/n by Cauchy–Schwarz.
    • By Jensen, E‖Σσᵢxᵢ‖ ≤ (E‖Σσᵢxᵢ‖²)^{1/2} = (Σ‖xᵢ‖²)^{1/2}, since the cross terms have mean zero.
  4. The realizable threshold. For realizable thresholds, show ERM's risk exceeds \(\varepsilon\) with probability at most \(2(1 - \varepsilon)^n\).

    Solution
    • Let the truth be t₀ and let A₊ = [t₀, t₀ + ε′] carry probability ε (similarly A₋ below t₀).
    • ERM's threshold lies within the sample points nearest t₀, so if the risk exceeds ε then no sample point fell in A₊ or none fell in A₋.
    • Each has probability (1 − ε)ⁿ; a union bound gives 2(1 − ε)ⁿ ≤ 2e^{−nε}, so the risk is O(log(1/δ)/n).
  5. Hedge's regret. Prove Hedge's regret bound \(\log K/\eta + \eta T/8\) with the potential \(\Phi_t = \log\sum_k e^{-\eta L_{t,k}}\).

    Solution
    • Let W_t = Σₖ e^{−ηL_{t,k}}. Then log(W_{t+1}/W_t) = log E_{w_t} e^{−ηℓ_t(k)} ≤ −η w_t·ℓ_t + η²/8 by Hoeffding's lemma.
    • Summing: log W_{T+1} − log K ≤ −η·(your loss) + η²T/8.
    • And log W_{T+1} ≥ −η min_k L_{T,k}. Rearranging: regret ≤ log K/η + ηT/8.
  6. The hinge's ψ. Find \(\psi\) for the hinge loss: show conditional excess hinge risk dominates conditional 0–1 excess.

    Solution
    • At a point with η = η(x), the conditional hinge risk of a prediction f is η(1 − f)₊ + (1 − η)(1 + f)₊, which is minimized over f ∈ [−1, 1] at sign(2η − 1), with value 1 − |2η − 1|.
    • A prediction with the wrong sign has hinge risk at least 1 (at f = 0), an excess of at least |2η − 1|, which is exactly the excess 0–1 risk at that point. So ψ(θ) = |θ|.

Notes and sources

Where it comes back

  • Part 55: the qualifying exam's learning-theory problem.
  • Part 57: conformal guarantees, distribution-free.
  • Part 58: online learning becomes betting: e-values.
  • Part 59: exact risks of interpolators in proportional asymptotics.
  • Part 64: the generalization of foundation models.

Glossary

  • Capacity.
    • Shattering; growth function; VC dimension; Sauer–Shelah; pseudo-dimension; fat-shattering; covering number: counting.
    • Rademacher complexity; symmetrization; contraction; Massart's lemma; Gaussian complexity: fitting noise.
  • Learning.
    • ERM; realizable; agnostic; PAC; structural risk minimization; oracle inequality; no free lunch.
    • Excess risk; slow and fast rates; Massart noise; Tsybakov noise; Bernstein condition; local Rademacher complexity; critical radius.
  • Algorithms.
    • Margin; AdaBoost; gradient boosting; SVM; support vector; sample compression.
    • Gibbs posterior; PAC-Bayes; kl inverse; uniform stability; differential privacy; reusable holdout.
    • Regret; Hedge; online-to-batch; bandit; UCB; EXP3; online gradient descent; mirror descent.
  • Losses and interpolation.
    • Surrogate; classification-calibrated; ψ-transform; proper loss.
    • Interpolation; double descent; min-norm interpolator; benign overfitting; effective rank; implicit bias.

Sources

  • Foundations. V. Vapnik & A. Chervonenkis, Theory Probab. Appl. 16 (1971); N. Sauer, J. Comb. Theory A 13 (1972); S. Shelah, Pacific J. Math. 41 (1972); L. Valiant, CACM 27 (1984); A. Blumer, A. Ehrenfeucht, D. Haussler & M. Warmuth, JACM 36 (1989); A. Ehrenfeucht, D. Haussler, M. Kearns & L. Valiant, Inf. Comput. 82 (1989); D. Wolpert, Neural Comput. 8 (1996).
  • Capacity. P. Bartlett & S. Mendelson, JMLR 3 (2002); V. Koltchinskii, IEEE Trans. Inf. Theory 47 (2001); M. Ledoux & M. Talagrand, Probability in Banach Spaces (1991); P. Massart, Ann. Fac. Sci. Toulouse 9 (2000); D. Haussler, J. Comb. Theory A 69 (1995); N. Alon, S. Ben-David, N. Cesa-Bianchi & D. Haussler, JACM 44 (1997); P. Bartlett, D. Foster & M. Telgarsky, NeurIPS (2017); N. Golowich, A. Rakhlin & O. Shamir, COLT (2018).
  • Fast rates. P. Massart & É. Nédélec, Ann. Stat. 34 (2006); A. Tsybakov, Ann. Stat. 32 (2004); P. Bartlett, O. Bousquet & S. Mendelson, Ann. Stat. 33 (2005); V. Koltchinskii, Ann. Stat. 34 (2006); P. Bartlett & S. Mendelson, PTRF 135 (2006).
  • Margins. Y. Freund & R. Schapire, JCSS 55 (1997); R. Schapire, Y. Freund, P. Bartlett & W. S. Lee, Ann. Stat. 26 (1998); J. Friedman, T. Hastie & R. Tibshirani, Ann. Stat. 28 (2000); J. Friedman, Ann. Stat. 29 (2001); C. Cortes & V. Vapnik, Mach. Learn. 20 (1995); N. Littlestone & M. Warmuth (1986).
  • PAC-Bayes. D. McAllester, Mach. Learn. 37 (1999); A. Maurer (2004); O. Catoni, PAC-Bayesian Supervised Classification (2007); P. Germain, F. Bach, A. Lacoste & S. Lacoste-Julien, NeurIPS (2016); G. K. Dziugaite & D. Roy, UAI (2017).
  • Stability. O. Bousquet & A. Elisseeff, JMLR 2 (2002); M. Hardt, B. Recht & Y. Singer, ICML (2016); C. Dwork, V. Feldman, M. Hardt, T. Pitassi, O. Reingold & A. Roth, Science 349 (2015).
  • Online learning. N. Cesa-Bianchi, A. Conconi & C. Gentile, IEEE Trans. Inf. Theory 50 (2004); M. Zinkevich, ICML (2003); E. Hazan, A. Agarwal & S. Kale, Mach. Learn. 69 (2007); A. Nemirovski & D. Yudin (1983); P. Auer, N. Cesa-Bianchi & P. Fischer, Mach. Learn. 47 (2002); P. Auer, N. Cesa-Bianchi, Y. Freund & R. Schapire, SIAM J. Comput. 32 (2002); T. L. Lai & H. Robbins, Adv. Appl. Math. 6 (1985).
  • Surrogates. T. Zhang, Ann. Stat. 32 (2004); P. Bartlett, M. Jordan & J. McAuliffe, JASA 101 (2006); A. Tewari & P. Bartlett, JMLR 8 (2007); J. Platt (1999).
  • Interpolation. C. Zhang, S. Bengio, M. Hardt, B. Recht & O. Vinyals, ICLR (2017); M. Belkin, D. Hsu, S. Ma & S. Mandal, PNAS 116 (2019); M. Belkin, D. Hsu & J. Xu, SIAM J. Math. Data Sci. 2 (2020); T. Hastie, A. Montanari, S. Rosset & R. Tibshirani, Ann. Stat. 50 (2022); P. Bartlett, P. Long, G. Lugosi & A. Tsigler, PNAS 117 (2020); T. Liang & A. Rakhlin, Ann. Stat. 48 (2020); M. Belkin, A. Rakhlin & A. Tsybakov, AISTATS (2019); V. Nagarajan & J. Kolter, NeurIPS (2019).
  • Data. W. Wolberg, W. Street & O. Mangasarian, Wisconsin Diagnostic Breast Cancer (1995).
  • Books. S. Shalev-Shwartz & S. Ben-David, Understanding Machine Learning (2014); F. Bach, Learning Theory from First Principles (2024); M. Mohri, A. Rostamizadeh & A. Talwalkar, Foundations of Machine Learning (2018); M. Wainwright, High-Dimensional Statistics (2019), ch. 4, 13, 14; V. Vapnik, Statistical Learning Theory (1998); N. Cesa-Bianchi & G. Lugosi, Prediction, Learning, and Games (2006).
About this partfrom its README

Part 54 of a sixty-five-part course in statistics, from a first course to a PhD (see the series plan and the syllabus), and the twelfth part of Stage IV, the PhD core: the last course before the qualifying exam.

It opens in Moscow in 1971, where Vladimir Vapnik and Alexey Chervonenkis asked when the empirical risk converges to the true risk uniformly over a class of rules, and answered with shattering. The part asks why fitting data generalizes at all, and why modern interpolating models seem to break the answer:

  • empirical risk minimization, uniform convergence, realizable and agnostic PAC learning (Valiant 1984), structural risk minimization and the no-free-lunch theorem;
  • VC bounds by symmetrization and Sauer–Shelah (proved), matching lower bounds, pseudo- and fat-shattering dimensions, and selection on the Board;
  • Rademacher complexity: symmetrization, the contraction lemma, Massart's lemma, linear and kernel classes, deep networks' norm-based bounds;
  • localization and fast rates: Massart and Tsybakov noise, the Bernstein condition, the fixed point, nonparametric regression's critical radius;
  • margins: AdaBoost on the breast cancer data, the margin bound, boosting as a statistician reads it, SVMs and sample compression;
  • PAC-Bayes: McAllester's and Maurer's bounds for a Gibbs posterior, the Gibbs variational identity and its distinction from a bounded-loss guarantee, non-vacuous bounds for deep networks;
  • stability: ridge regression, SGD (Hardt, Recht & Singer 2016), differential privacy and the reusable holdout;
  • online learning: Hedge, online-to-batch, bandits (UCB1, EXP3, Lai–Robbins), online convex optimization and mirror descent;
  • classification-calibrated surrogates, ψ-transforms, noise conditions and proper losses;
  • interpolation: double descent, benign overfitting, and why uniform convergence cannot explain it (Nagarajan & Kolter 2019).

It keeps three promises:

  • Part 48's uniform laws, VC classes and chaining were studied for their own sake. Chapters 1–4 turn them into the risk of the rule you chose.
  • Part 34 calibrated and conformalized predictions by experiment, for a fixed model. Chapters 5–9 say why the learning algorithm itself generalizes.
  • Part 53's Gibbs posteriors for misspecified models get PAC-Bayes bounds in chapter 6.

Built in this part:

  • statkit.slt (explainer/stats/kit/slt.py), tested in tests/test_stats_kit_slt.py:
    • thresholds: data and exact risk; local checked ERM and exact deviation at all grouped jump limits; VC, Rademacher and finite-class bounds;
    • Rademacher complexity of linear and kernel classes by Monte Carlo against their trace bounds;
    • AdaBoost with decision stumps, recording training and test error and normalized margins;
    • PAC-Bayes: binary KL and its inverse, McAllester's and the kl bound, Gibbs posteriors over a finite class;
    • stability: bounded ridge sampled replacement-loss diagnostics; coupled SGD mean divergence with Monte Carlo errors;
    • online learning: Hedge and its bound; Bernoulli bandits with UCB1, EXP3 and ε-greedy; Lai–Robbins's bound;
    • ψ-transforms of the hinge, logistic, exponential and squared losses;
    • interpolation: latent excess prediction risk of min-norm fits, finite simulated averages and exact expected risks away from the singular range; verified interpolation in the benign design.
  • The shatterer (Shatterer in explainer/stats/viz.py), the part's instrument: a panel of labelled points with a separating half-plane clipped to the frame, or a cross where no half-plane realizes the labelling, so that a whole set of dichotomies can be laid out and counted.

Data.

  • From the Museum: the Wisconsin breast cancer data (569 tumours, 30 features).
  • The rest is exact arithmetic or seeded simulation.

The Coverage Board gains three rows:

Method Setting Nominal Achieved Verdict
Wald interval on the training error best of 1,000 classifiers, n = 200 95% 0% broken
Hoeffding + union bound over the class best of 1,000 classifiers, n = 200 95% 99.8% conservative
Wald interval on a fresh holdout best of 1,000 classifiers, n = 200 95% 94.0% kept
Chapter notes
# Chapter Numbers
0 Vapnik and Chervonenkis half-planes on n random points: 2, 4, 8, 14, 22, 32, 44, 58, 74 labellings (2ⁿ = 512 at n = 9; Sauer's bound 130); four points in a square: 14 of 16
1 ERM thresholds, n = 25 → 1,600: excess risk 0.039 → 0.0006 (realizable), 0.050 → 0.0026 (η = 0.4); uniform deviation 0.17 → 0.021
2 VC bounds VC bound 1.72 → 0.26, Rademacher bound 1.16 → 0.20 for d = 1; union half-width 0.163 for K = 1,000, n = 200; Board as above
3 Rademacher linear class 0.221 → 0.034 (bound 0.225 → 0.036); Gaussian kernel 0.200 → 0.035 (bound 0.200 → 0.035) for n = 25 → 800
4 Localization excess risk slopes ≈ −1 against the deviation's −½, for noise 0, 0.1 and 0.4
5 Margins breast cancer, 340 train / 229 test: tie-safe stumps: zero training error at round 9; test error 0.0742 at round 9 → 0.0437 at round 400; minimum margin −0.178 (5), 0.178 (50), 0.215 (400)
6 PAC-Bayes 101 thresholds, n = 500, noise 0.15: best kl bound 0.211 (λ = 200, true risk 0.155) vs union bound 0.221; McAllester 0.234
7 Stability bounded ridge, n = 200, p = 50: sampled loss changes 0.1316 → 0.000492 and signed gap 0.04695 → −0.002540 over λ = 10⁻³ → 3 (10 datasets); SGD divergence after 10 epochs 0.16 (η = 0.2; bound 4) and 0.27 (η = 1; bound 20)
8 Online learning Hedge, K = 50, T = 5,000: regret 51.7 vs bound 98.9; bandits, T = 50,000: ε-greedy 1,193, EXP3 962, UCB1 269, Lai–Robbins 75
9 Surrogates ψ(θ) = |θ| (hinge), θ² (squared), 1 − √(1 − θ²) (exponential)
10 Interpolation min-norm least squares, n = 100: 12-dataset mean latent excess risk 1.14 (p = 10), 1,392 (p = n), 0.925 (p = 1,000); population mean is infinite at p = n−1, n, n+1; benign excess 0.191 → 0.013 for n = 50 → 400; short tail 0.246
11 Outro —
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
  1. Hook: Vapnik & Chervonenkis (1971).
  2. ERM and uniform convergence.
  3. VC bounds, from Part 48.
  4. Rademacher complexity. The contraction lemma; linear and kernel classes.
  5. Localization and fast rates (Bartlett, Bousquet & Mendelson 2005; Koltchinskii 2006).
  6. Margins for boosting and SVMs.
  7. PAC-Bayes (McAllester 1999; Catoni 2007).
  8. Stability (Bousquet & Elisseeff 2002).
  9. Online learning. Regret; online-to-batch conversion.
  10. Classification-calibrated surrogates (Bartlett, Jordan & McAuliffe 2006).
  11. Interpolation. Benign overfitting (Bartlett et al. 2020); why uniform convergence can fail to explain it (Nagarajan & Kolter 2019).
  12. Outro.

Built: statkit.slt. Books: Shalev-Shwartz & Ben-David; Bach; Mohri et al.; Wainwright.

Build the film

python -m videos.stats.stats54.compute        # the part's numbers, into .cache/stats54
python tools/build.py stats54                  # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py stats54 Hook   # one chapter, silent, with a contact sheet

Scenes: videos/stats/stats54. Setup: see the course page. Source of these notes: the README and the scenes' narration.

Build it
OMP_NUM_THREADS=1 python -m videos.stats.stats54.compute   # once (a few minutes)
python tools/build.py stats54 -q l                         # fast 480p preview
python tools/build.py stats54                              # 1080p30 -> renders/stats54.mp4
python tools/qa_scene.py stats54 Online
python tools/lecture_length.py stats54 --floor 50