TL;DR

  1. Setup: ERM over a function class chosen in advance. Consistency w.r.t. means : it concerns only the estimation error. The question is when ERM succeeds, and the answer is: when the complexity of is under control.
  2. Hoeffding: for independent , . For a fixed function this gives : error , sample size .
  3. Uniform convergence is sufficient and necessary for the consistency of ERM (Vapnik and Chervonenkis 1971).
  4. Finite class with functions (union bound): for all . We pay only .
  5. Infinite classes: replace by the shattering coefficient (symmetrization with a ghost sample). The VC dimension is the largest with . Sauer-Shelah: , so the growth function is either or polynomial. Bound: ; ERM is consistent iff .
  6. VC of linear classifiers in : . With margin on data in a ball of radius : , dimension-free. Neural networks: . Rademacher complexity measures how well fits random labels. In the overparameterized regime all these bounds are vacuous.

Exam relevance

  • Real exam, task type “VC dimension and growth function” (4 P): a table of values ; read off the VC dimension and decide which rows are valid or impossible growth functions (Sauer-Shelah, monotonicity, ). Train it with the task and part 3 of the widget.
  • Real exam, task type “bounds” (4 P): select which function or rate satisfies a condition (does it go to 0, at which rate). See this task.
  • Mock exam: MC on comparing two bounds (rates vs. ) and on Sauer-Shelah; a longer task on the VC dimension of intervals and unions of two intervals (Sheet 4, Exercise 2).
  • Sheet 3: Hoeffding sample sizes (Exercise 1) and validating classifiers at once with a union bound (Exercise 2). Sheet 4, Exercise 3: VC bounds for one-vs-all multiclass classification.

Overview: 1. Setup and consistency w.r.t. , 2. Concentration inequalities, 3. The error of a fixed function and uniform convergence, 4. Finite classes, 5. Infinite classes: shattering coefficient, growth function, 6. VC dimension, 7. Rademacher complexity, 8. Limitations and outlook.

Statistical learning theory

Setup

Slides 3-5

(Literature: von Luxburg and Schölkopf 2011 for a high-level overview; Bousquet, Boucheron and Lugosi 2003 more technical; Devroye, Györfi and Lugosi 1996 the classical book; Shalev-Shwartz and Ben-David less technical, Bach pretty technical.)

We consider the standard setup: an unknown distribution generates the data, and we look at binary classification, typically with the 0-1 loss (the maths is simpler; many results hold more generally). The training data is i.i.d. from . Because we do not know , we perform ERM over a fixed function class chosen in advance, before seeing the data. We do not ask how to solve the optimization problem; we assume we always find an empirical risk minimizer. We ask under which conditions this approach is “successful”. One approach that leads to successful learning consists in bounding the complexity of the function class .

Consistency with respect to the function class

Slides 6-7

Notation: is the Bayes classifier, the best classifier in , and the classifier chosen from on a sample of points.

Three kinds of consistency

  1. Consistent with respect to and : as .
  2. Bayes-consistent with respect to : as .
  3. Universally consistent with respect to (resp. universally Bayes-consistent): consistent w.r.t. (resp. Bayes-consistent) for all .

Trap

Consistency with respect to a fixed only concerns the estimation error , not the approximation error. All bounds in this lecture control the estimation error. (In Lecture 1.2, was written .)

Concentration inequalities

From the law of large numbers to concentration

Slides 8-10

(Literature: Bach Sec. 1.2; Hoeffding in every learning theory book; McDiarmid 1989; the book Concentration Inequalities by Boucheron, Lugosi and Massart.)

The LLN (Proposition 1: almost surely) is qualitative. In learning theory we want quantitative versions: how far is the empirical average from the true one, and with which probability? Such statements are concentration inequalities:

where goes to 0 very fast as grows.

Left: a wide distribution, large deviations from the mean occur often. Right: a peaked distribution, large deviations are extremely unlikely
Slide 10: not concentrated (left) and concentrated (right) around E(X).

Hoeffding’s inequality

Slides 11-12

Proposition 2 (Chernoff 1952, Hoeffding 1963)

Let be independent random variables with values in . Then for any ,

(Proof skipped.)

  • The random variables do not need to have the same distribution, as long as their range (more generally, their variance) is controlled.
  • Independence is crucial.
  • Whenever you want to prove concentration, Hoeffding is always the first thing to try.
  • It is tight in some situations (fair coin tosses) and not so tight in others; if you know more about the variables, other inequalities may be better.

Mini example: coin tosses

fair coin tosses, : the frequency of heads deviates from by at least with probability at most . With : . Ten times more data makes the exponent ten times larger.

McDiarmid’s inequality

Slides 13-14

Theorem 3 (McDiarmid, bounded differences inequality)

Let and assume there are constants such that for all and :

Let be independent. Then

Hoeffding as a special case

Take with . Changing one coordinate changes by at most , so and the bound becomes : Hoeffding. McDiarmid is super useful beyond learning theory (randomized algorithms) and comes back in the section on stability (Lecture 4).

Controlling the estimation error: generalization bounds

The error of a fixed function

Slides 15-20

For a fixed function we saw strong consistency from the LLN (Lecture 1.2). Hoeffding gives a sharper result:

Proposition 4 (error in measuring the risk of a fixed function)

Fix and consider a bounded loss. Then

The same statement as a generalization bound

Fix an error probability (say 0.05), set and solve for : with probability at least ,

The factor 2

Hoeffding for the two-sided event has the factor 2: , which gives . Proposition 4 on slide 17 drops it; the finite-class bound (slide 29) keeps it. In a computation, use unless the task says otherwise.

Sample complexity of error estimation

  • Error at most with a fixed small failure probability needs , i.e. .
  • The error with sample points scales as .

If you already fixed (by some complicated training) and want to estimate its test error up to on a fresh test set, you need of the order test points. It is impossible to beat or trick these numbers.

Uniform convergence

Slides 21-25

The bound holds only for a fixed , and we saw that this does not make ERM consistent. Idea: require that the empirical risk is close to the true risk for all functions in simultaneously. Then it is also close for the function the algorithm picks.

Definition 5 (uniform convergence)

converges to uniformly over (the law of large numbers holds uniformly over ) if

Proposition 6 (uniform convergence is sufficient for consistency)

Let minimize the empirical risk in . Then

Uniform convergence is necessary

Slides 26-27

Theorem 7 (Vapnik and Chervonenkis 1971)

Let be any function class. Then ERM is uniformly consistent with respect to if and only if uniform convergence holds:

The proof is beyond the scope of the lecture; the “necessary” direction is a very deep result.

The big question now: how do we know whether uniform convergence holds for a function class ?

Generalization bound for finite classes

Capacity measures

Slides 28-29

  • If is too large (the counterexample in Lecture 1.2), there is no uniform convergence.
  • If is small (a single function), there is uniform convergence.

We want to measure the size of a function class in a way that bounds .

The union bound for finitely many functions

Slides 30-33

For and Hoeffding for each :

Proposition 8 and Theorem 9 (generalization bound for finite classes)

Let be finite with functions. For : with probability at least , for all . Setting : with probability at least , for all

Digesting the bound

  • True risk empirical risk + a “capacity term”.
  • A larger class (larger ) gives a worse bound, but only logarithmically in . The rate is again : the error scales as .
  • The bound holds uniformly for all , so in particular for the function the algorithm picks based on the data.
  • If you let the class grow with to fit better, you need for consistency.
The bound for a fixed function, for a finite class of m functions and for a class of VC dimension d, against n on log-log axes. The dots mark the sample size needed for the target accuracy ε. Move m, d and δ.

Task: Hoeffding and sample sizes

Exam-style task: how many validation points? (4 P)

Use for a fixed .

(a) (1 P, easy) How many test points guarantee with probability at least for one fixed classifier?

(b) (1.5 P, harder) You validate classifiers on the same test set and want the guarantee for all of them simultaneously. How many points now?

(c) (1.5 P, transfer) By which factor does the answer of (a) change if is halved? And the answer of (b) if is squared to ?

Example: partitioning-based estimators

Slides 34-42

Split into a grid of cells of equal size and let be all functions that are piecewise constant (0 or 1) on the cells. .

The unit interval split into grid cells, with a piecewise constant 0/1 function
Slide 35: a piecewise constant function on k grid cells.

How should depend on ?

  • : the estimation error converges to 0 very quickly (two functions), but the approximation error stays large (a constant cannot approximate the Bayes classifier).
  • or larger: the estimation error is large (about one point per cell), the approximation error might be small.
  • Intuition: to get the estimation error to 0 we need “infinitely many points” in each cell; to get the approximation error to 0 we need ever finer cells.

Consistency of partitioning estimators

  • fixed: the key term is : ERM is uniformly consistent w.r.t. (estimation error ), but not Bayes-consistent in general.
  • growing: consistency w.r.t. needs (for example ): there are about points per cell. For Bayes consistency we additionally need (plus regularity of , so that it can be approximated by histograms).
  • In dimensions: cells, functions, error term : exponentially many samples in . Not a very practical idea.

Trap

These results only hold if the partition is formed independently of the data. For data-dependent partitions (kNN, decision trees, random forests) one needs different techniques.

Infinite classes: shattering coefficient and growth function

Why the finite bound fails

Slides 43-44

For finite classes we measure the size by the number of functions, which gives a bound with plausible behaviour. For an infinite class (all linear functions, say) and the union bound gives nothing.

The shattering coefficient

Slides 45-48

Shattering coefficient

For a sample let be the restrictions of the functions to the sample (the labelings can produce on it). The shattering coefficient is the maximal number of such labelings:

Three points on the line and the half-lines [a, infinity): only 4 of the 8 labelings are realizable
Slide 46: 𝓕 = half-lines [a, ∞) on ℝ realizes only 4 of 8 labelings of three points: 𝒩(𝓕, 3) = 4. In general 𝒩(𝓕, n) = n + 1.
Three data sets of five points in the plane and the number of ways a horizontal line separates them: 5, 6 and 2
Slide 47: positive class = above a horizontal line. The count depends on the data set; the maximum over data sets is 𝒩(𝓕, 5) = 6.

Example 3 (slide 48): , = interiors of circles. Question: can you bound the shattering coefficient for small ?

Generalization bound with the shattering coefficient

Slides 49-53

Theorem 10 (generalization bound with the shattering coefficient)

Let be any function class. For all :

The other way round: with probability at least , all satisfy

Discussion

  • The bound is the finite-class bound with replaced by the shattering coefficient.
  • The shattering coefficient measures how powerful a class is: how many different labelings of a data set it can realize. Overfitting happens if the class can fit everything; then the shattering coefficient is large and there is no consistency.
  • For consistency we need : the number of labelings has to grow at most polynomially in (sub-exponentially).
  • Shattering coefficients are complicated to compute. The VC dimension below is the tool that tells us how fast they grow.

The growth function

Slide 54

Growth function

To stress how the shattering coefficient behaves with , one also calls it the growth function: . Another common notation is .

Properties every growth function has (for exam tables)

  • (the empty set has one labeling) and .
  • Non-decreasing: , since every labeling of points restricts to a labeling of of them.
  • At most doubling: , since each labeling of points extends in at most two ways.
  • Once , also for all (a subset of a shattered set is shattered), and Sauer-Shelah bounds all values by with the VC dimension.
1: all labelings of n points on the line, and which ones a class realizes. 2: the growth function against 2ⁿ and the Sauer-Shelah bound. 3: type a row of an exam table and check whether it can be a growth function.

VC dimension

Definition and examples

Slides 55-62

Shattering and VC dimension

shatters a set of points if it can realize all labelings: . The VC dimension is the largest such that there exists a sample of size that is shattered:

If the maximum does not exist, . (VC stands for Vapnik and Chervonenkis.)

"There exists" vs. "for all"

  • To show : find one set of points that is shattered.
  • To show : show that no set of points is shattered (for every configuration, give a labeling that cannot be realized).

Some sets of size may not be shattered (four points on a line cannot be shattered by rectangles), and that does not matter.

Closed intervals on the line: two points can be shattered, three points cannot because the labeling plus minus plus is impossible; VC = 2
Slide 58: closed intervals [a, b] on ℝ. Two points are shattered; for three points, (+, −, +) is impossible. VC = 2.
Axis-parallel rectangles in the plane: a diamond of four points is shattered, no five points can be shattered; VC = 4
Slide 59: axis-parallel rectangles in ℝ². A diamond of 4 points is shattered (VC ≥ 4). Among 5 points one is not extreme in both axis directions; label it − and the others +: impossible. VC = 4.
Convex polygons with d corners: 2d+1 points on a circle can be shattered
Slide 60: convex polygons with d corners in ℝ² have VC = 2d + 1. Lower bound: 2d + 1 points on a circle can be shattered (few red points: take their polygon; many red points: cut off the blue ones).

VC dimensions to know

ClassVC dimension
half-lines on 1
closed intervals on 2
unions of at most two intervals (Sheet 4, mock)4
axis-parallel rectangles in 4
convex polygons with corners in
, (one parameter!)
linear classifiers in
a finite class (Sheet 4)

Number of parameters ≠ VC dimension

The sine class has a single parameter and infinite VC dimension. The VC dimension counts the labelings a class can produce, not its parameters.

The Sauer-Shelah lemma

Slides 63-64

Proposition 12 (Vapnik, Chervonenkis, Sauer, Shelah)

Let have finite VC dimension . Then for all

and in particular for all : .

(Proof: a nice combinatorial argument, see the exercises.)

A dichotomy

  • Finite VC dimension: the shattering coefficient grows only polynomially, like .
  • Infinite VC dimension: it is for all , exponential.
  • It is impossible that the growth is “slightly smaller” than : it is either or much smaller, polynomial. Up to it is , after that polynomial.

Mini example

Intervals have and , exactly the Sauer-Shelah bound. At : labelings instead of .

Task: growth function tables

Exam-style task: VC dimension from a table (4 P)

Five candidate growth functions:

12345
2471116
2481526
23546
2471520
2481632

(a) (1 P, easy) Read off the VC dimension of , and (as far as the table allows).

(b) (1.5 P, harder) Which rows are impossible as growth functions? Give a reason for each.

(c) (1.5 P, backwards) A class has . What is ? Give the best upper bound on .

Generalization bound with the VC dimension

Slides 65-67

Plugging Sauer-Shelah into Theorem 10 ():

Theorem 13 (generalization bound with the VC dimension)

Let have VC dimension . With probability at least , all satisfy

Consequence: finite VC dimension consistency.

Theorem 14

Empirical risk minimization is consistent with respect to if and only if is finite. (Proof skipped.)

Sample size: set , solve for and ignore constants: we need of the order sample points (up to logarithmic factors).

Task: which growth functions give consistency?

Exam-style task: selecting the valid rates (4 P)

Theorem 10 gives consistency of ERM if . Consider

(i)(ii)(iii)(iv)

(a) (1 P, easy) For which rows does ?

(b) (1.5 P, harder) Which row cannot be the growth function of any class? Why?

(c) (1.5 P, transfer) For row (i), how does the capacity term of Theorem 13 decay with ? How many points does it need, compared to row (iii), for the same accuracy?

VC dimension of linear classifiers

Slides 68-71

(Literature: the VC dimension of linear classifiers is in many textbooks; the large margin proof is written up in Hush and Scovel, “On the VC Dimension of Bounded Margin Classifiers”, Machine Learning 2001.)

Proposition 15 (VC dimension of linear classifiers)

Let with . Then .

Mini example:

Three points in general position in the plane can be shattered by lines (VC ). Four points cannot: either one lies in the triangle of the other three (label it , the others ), or they form a convex quadrilateral (label the diagonals alike: the XOR pattern). VC = 3 = . Without the offset (lines through the origin), the VC dimension is .

Linear classifiers with a margin

Slides 72-76

If the data can be separated not only by some hyperplane but by one with margin (as for the perceptron), does this improve the VC dimension?

Points in a ball, separated by a hyperplane with a margin band around it
Slide 72: data in a ball of radius R, separated with margin ρ.

Theorem 16 (VC dimension of large margin hyperplanes)

Let lie in a sphere of radius and let be the linear classifiers with margin , restricted to the sphere. Then

Trap

Slide 62 states the margin result as , Theorem 16 on slide 73 as . The constants differ; the message is the same: the margin bound does not depend on the dimension.

Discussion

The VC bound for general hyperplanes depends on the dimension, which is natural. The margin-based bound does not depend on at all, but it needs extra knowledge about the data distribution (a margin). We have seen the same ratio in the perceptron mistake bound (Lecture 2).

VC dimension of neural networks

Slides 77-86

VC dimension of a 2-layer network (sketch)

Input , hidden units , output . Then the VC dimension is of order .

  • Typical results: a 2-layer network (threshold, sigmoid, ReLU activations) has VC dimension of order with the number of parameters, consistent with above. Multi-layer ReLU networks with layers: .
  • Key technique in these proofs: counting regions. Fix a data point ; in the space of all parameter vectors (not the data space), the set where is classified positive is bounded by a separating curve. Adding points adds curves; each region corresponds to one labeling of the data. The number of regions is the number of labelings, and one has to be clever to count them.
  • Discussion: the bound depends heavily on the dimension. Modern networks are very large, so VC generalization bounds are vacuous and cannot explain why neural networks learn (see Lecture 8).

Rademacher complexity

Slides 87-89

The shattering coefficient is a purely combinatorial object: it ignores the actual distribution. This seems suboptimal.

Rademacher complexity

Fix and let be i.i.d. fair coin tosses with values . The Rademacher complexity of is

with the expectation over the random points and the random labels . It measures how well the class can fit random labels.

Theorem 17 (Rademacher generalization bound)

With probability at least , for all ,

(Proofs are beyond the scope of the lecture.) These bounds tend to be sharper than the combinatorial ones, and computing Rademacher complexities is in many cases much simpler than computing shattering coefficients or VC dimensions.

Mini example: two extreme classes

A single function : , so . All functions (with distinct points): choose , then the sum is and : the class fits any random labeling, and the bound is useless.

Generalization bounds: summary

Slide 90

The common form

With probability at least , for all :

The capacity term measures the size of the function class, the confidence term how certain we are about the statement.

  • Generalization bounds answer whether a learning algorithm is consistent within . They give insight but are not practical for concrete numbers.
  • They concern the estimation error, not the approximation error.
  • They are worst-case bounds: worst case over all distributions, and worst case over all learning algorithms that pick a function from .
Capacity measureBound on (w.p. )Rate
fixed function
functions
shattering coefficientneeds
VC dimension ,
Rademacherdepends on

Limitations and outlook

Limitations of SLT and the ERM principle

Slides 91-93

  • The standard approach of SLT proves generalization by bounding the capacity of the function class. It revealed many important principles, and it applies primarily to the under-parameterized regime, where uniform convergence can be controlled.
  • It is often technically challenging (how to compute the VC dimension or the Rademacher complexity of the class of a particular algorithm?).
  • It gives worst-case guarantees over all functions in the class rather than looking at the actual algorithm. In particular, it does not matter which ERM minimizer an algorithm selects: the bounds apply to all of them or to none.
  • In the overparameterized regime the bounds are still valid but vacuous. For linear classification with the bound just says something large. Correct, but useless.

Different minima with different properties

Slides 94-95

Many empirical risk minimizers, some good and some bad

  • Data in from , true output (the first coordinate), i.e. with . Minimize the squared loss on training points with .
  • The linear system is under-determined, with many solutions: the true (test error 0), but also every with . The test error of such a vector is , as large as we want.
  • VC theory gives nothing here (the bound is large when ). Some minimizers are good, some are bad. Observe for later: the good solution has the minimum norm among all solutions.

Outlook

Slide 96

In the overparameterized regime we need a mechanism that selects a good solution among the many minimizers. Principles that help:

  • Stability: stable optima tend to generalize better (Lecture 4).
  • Explicit regularization: reduce the capacity of the solution space; then standard bounds apply again in some cases (Lecture 5).
  • Implicit regularization: some optimization algorithms such as SGD converge to the minimum norm solution; under favourable assumptions (benign overfitting) such solutions generalize (Lecture 8).

Task: VC dimension of two-sided half-lines

Exam-style task: a VC dimension with a bound (4 P)

: positive on a right or on a left half-line.

(a) (1 P, easy) Show that for .

(b) (1.5 P, harder) Determine and check the value against Sauer-Shelah.

(c) (1.5 P, transfer) Evaluate the capacity term of Theorem 10 for and .

Self-Test

Multiple Choice

References