Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Measuring flexibility by shattering
How flexible is “all straight lines” as a way to split points into two groups? Place 3 points in a triangle: whatever colouring you choose for them, some line separates the colours. That set is shattered. Now try 4 points at the corners of a square, coloured diagonally (top-left and bottom-right red, the other two blue). No straight line can split them. The biggest set a class can always shatter, here 3, is its VC dimension. It works like a parameter count, but it measures what the model can actually do.
VC dimension explains why a linear classifier on 10 features needs on the order of tens of examples, while a model that can shatter any dataset can’t generalize at all. It underlies classic results for support vector machines and perceptrons, and it is the first tool that handles infinite model classes rigorously.
- 1. A class shatters a set of points if…
- 2. The VC dimension of lines (half-planes) in the plane is…
- 3. Higher VC dimension means the class is…
Level 1: Beginner
★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.Definitions
- The growth function is the maximum, over sets of m points, of the number of distinct labelings H produces.
- H shatters a set S if it realizes all labelings of S.
- The VC dimension is the size of the largest shattered set (∞ if sets of every size can be shattered).
To show , exhibit one shattered set of size d, and prove that no set of size d + 1 is shattered.
Examples
| class | VC dimension | why d + 1 points fail |
|---|---|---|
| thresholds on ℝ | 1 | the labeling (+, −) on two points needs a decreasing rule |
| intervals on ℝ | 2 | (+, −, +) on three points |
| half-planes in ℝ² | 3 | four points: an XOR pattern, or one point inside the triangle of the others |
| axis-aligned rectangles | 4 | five points: the extreme points trap the fifth |
| halfspaces in ℝ^d | d + 1 | Radon’s theorem |
- 1. VC dimension of intervals on the line:
- 2. To prove d_VC = d you must show…
- 3. VC dimension of halfspaces in ℝ¹⁰:
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Sauer’s lemma
If , then for every m,
So the growth function is exponential () only up to m = d, then polynomial. Intervals meet the bound with equality: . Half-planes on m points in general position realize exactly labelings (Cover, 1965): 14 of 16 for m = 4, and 58 of 256 for m = 8.
The VC generalization bound
Replacing |H| by in the union-bound argument (via a “ghost sample” symmetrization; Vapnik and Chervonenkis, 1971) gives, with probability ≥ 1 − δ, for all h ∈ H:
The fundamental theorem of statistical learning
For binary classification, these are equivalent: H has uniform convergence; H is agnostic PAC learnable; ERM learns H; . The sample complexity is (agnostic), and the bound is tight up to constants (Blumer et al., 1989; Shalev-Shwartz and Ben-David, 2014).
- 1. Sauer's lemma bounds the growth function by…
- 2. Half-planes realize how many labelings of 4 points in general position?
- 3. A class is PAC learnable iff its VC dimension is…
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Lower-bound proofs
- Intervals can’t shatter 3 points : an interval containing x₁ and x₃ contains x₂, so (+, −, +) is impossible. ∎
- Half-planes can’t shatter 4 points in ℝ². Either one point lies in the triangle of the other three (label it − and the others +: any half-plane containing the three contains their convex hull), or the four are in convex position, where the diagonal XOR labeling fails for the same reason. ∎
Sauer’s lemma (sketch)
Induct on m. Remove one point x. The labelings of the remaining m − 1 points split into those that extend in one way and those that extend both ways. The second family has VC dimension ≤ d − 1 (adding x to any set it shatters gives a set shattered by H). So , which is Pascal’s rule for . ∎
Why VC bounds are loose for real models
The bound is worst-case over distributions and ignores the data. For m = 200 and VC dimension 3 it is already 0.94, and above 1 (vacuous) for larger d. Data-dependent quantities (Rademacher complexity b2-4, margins, PAC-Bayes b2-8) are much tighter.
Exercise 3.1: polynomial vs exponential
For m = 100 and d = 3, Sauer gives labelings (the cruder ), versus possible labelings.
- 1. Sauer's induction is Pascal's rule because…
- 2. Why can't intervals realize (+, −, +)?
- 3. Σ_{i≤3} C(100, i) =
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.Counting labelings and measuring the gap
Exact counts. Sweeping 3600 normal directions finds every half-plane labeling of random points. The counts are 8, 14, 32 and 58 for m = 3, 4, 6 and 8, exactly Cover’s formula, and always below Sauer’s bound with VC dimension 3. Intervals give 2, 4, 7, 11, …, 37, meeting Sauer’s bound with equality.
Gap vs dimension. A least-squares linear classifier is trained on m = 200 noisy linear labels in ℝ^d. The average test − train error gap is:
| d | 2 | 5 | 10 | 20 | 40 |
|---|---|---|---|---|---|
| gap | 0.007 | 0.013 | 0.027 | 0.061 | 0.115 |
| VC bound | 0.94 | 1.19 | 1.48 | 1.87 | 2.36 |
The gap grows with dimension, here roughly in proportion to d/m (log–log slope 0.97). The worst-case √(d/m) rate isn’t reached at this low noise level, the same fast-rate effect as in b2-1. The VC bound predicts the trend but is 20–130× too large, and vacuous from d = 5.
VC theory in AI, robotics and aerospace
- Classic results: perceptron and SVM margin bounds (VC dimension of large-margin separators scales with (R/γ)², not with the dimension).
- Sample planning: rough data requirements for linear and kernel models on sensor features.
- Limits: for deep networks the VC dimension is huge (about parameters × depth), yet they generalize, which needs data-dependent and algorithm-dependent explanations (B4).
- Cover’s theorem also motivates kernels: mapping into high dimensions makes more labelings linearly separable (B3).
References
- V. Vapnik, A. Chervonenkis (1971). “On the uniform convergence of relative frequencies of events to their probabilities.” Theory of Probability and Its Applications, 16.
- N. Sauer (1972). “On the density of families of sets.” Journal of Combinatorial Theory A, 13.
- T. Cover (1965). “Geometrical and statistical properties of systems of linear inequalities with applications in pattern recognition.” IEEE Trans. Electronic Computers, 14.
- A. Blumer, A. Ehrenfeucht, D. Haussler, M. Warmuth (1989). “Learnability and the Vapnik–Chervonenkis dimension.” Journal of the ACM, 36.
- P. Bartlett, N. Harvey, C. Liaw, A. Mehrabian (2019). “Nearly-tight VC-dimension and pseudodimension bounds for piecewise linear neural networks.” JMLR, 20.