Quant Memo
Advanced

The Sauer-Shelah Lemma

A combinatorial result that caps how many distinct ways a family of classifiers can label a set of points, and shows why that cap is exactly what makes VC dimension a useful measure of model complexity.

Suppose you have a family of classifiers — say, all possible single vertical cutoffs on a number line — and nn labelled points. How many genuinely different ways can that family label those nn points as positive or negative? Naively, there are 2n2^n possible labelings, but most classifier families can't produce anywhere near all of them: a single cutoff can only ever split the points into "everything left is negative, everything right is positive," which is just n+1n+1 distinct labelings, not 2n2^n. The Sauer-Shelah lemma pins down exactly how slowly the number of achievable labelings can grow as nn increases, in terms of a single number describing the family's complexity.

That single number is the family's VC dimension, dd: the size of the largest set of points the family can label in every possible way. The lemma says that once nn exceeds dd, the number of distinct labelings the family can produce on any nn points is at most i=0d(ni)\sum_{i=0}^{d} \binom{n}{i}, which for large nn grows only polynomially, like ndn^d, rather than exponentially like 2n2^n. In plain terms: a family that can only "shatter" small sets of points close together is stuck growing slowly forever after, no matter how large the dataset gets.

For the single-cutoff example, d=1d = 1 (one point can always be labeled either way, but no two points can be split all four possible ways with a single cutoff). Plugging in, the bound gives at most n+1n + 1 labelings for nn points — which matches the exact count.

This gap between 2n2^n and a polynomial in nn is the mathematical reason learning theory can bound how much a model can overfit: a hypothesis family with bounded VC dimension can't fit an ever-larger fraction of all possible label patterns as data grows, so agreement with the training labels starts to mean something about the underlying pattern rather than sheer flexibility.

The Sauer-Shelah lemma shows that a hypothesis family with VC dimension dd can produce at most a polynomial number of distinct labelings of any nn points (roughly ndn^d), never the full exponential 2n2^n — the mathematical basis for why bounded model complexity limits overfitting.

Related concepts

Practice in interviews

Further reading

  • Sauer, 'On the density of families of sets', 1972
  • Shelah, 'A combinatorial problem', 1972
ShareTwitterLinkedIn