Skip to content
nonconvexcard

VC Dimension, Sauer's Lemma and Rademacher Complexity

The two standard measures of a hypothesis class's capacity, with complete proofs of Sauer's lemma and the Rademacher generalisation bound.

Learning TheoryGraduate⏱ 1 day18 min readvc dimensionsauer lemmarademacher complexitygrowth functionmargin bounds
6 problems →

VC dimension

DefinitionShattering, growth function, VC dimension

Let H⊆{±1}X\Hcal\subseteq\{\pm1\}^\Xcal. For C={x1,…,xn}⊆XC = \{x_1,\dots,x_n\}\subseteq\Xcal write

H∣C={(h(x1),…,h(xn)):h∈H}⊆{±1}n.\Hcal|_C = \big\{(h(x_1),\dots,h(x_n)) : h\in\Hcal\big\}\subseteq\{\pm1\}^n .

H\Hcal shatters CC if ∣H∣C∣=2n|\Hcal|_C| = 2^n. The growth function is ΠH(n)=max⁡∣C∣=n∣H∣C∣\Pi_\Hcal(n) = \max_{|C|=n}|\Hcal|_C|, and the VC dimension is

VC(H)=sup⁡{n:ΠH(n)=2n}.\mathrm{VC}(\Hcal) = \sup\{n : \Pi_\Hcal(n)=2^n\} .
TheoremSauer–Shelah lemma

If VC(H)=d<∞\mathrm{VC}(\Hcal)=d<\infty then for every nn,

ΠH(n)≤∑k=0d(nk)≤(end)d(n≥d).\Pi_\Hcal(n) \le \sum_{k=0}^d\binom nk \le \left(\frac{en}{d}\right)^d \quad (n \ge d).

Key idea

Sauer's lemma is a phase transition: the growth function is exactly 2n2^n up to n=dn=d and then switches to polynomial ndn^d forever after. There is no intermediate behaviour. This is what makes VC theory work: substituting log⁡ΠH(n)=O(dlog⁡n)\log\Pi_\Hcal(n) = O(d\log n) for log⁡N\log N in the finite-class bound gives a useful result, whereas log⁡2n=n\log2^n = n would give nothing at all.

TheoremVC generalisation bound

Let VC(H)=d\mathrm{VC}(\Hcal)=d and let ℓ\ell be the zero-one loss. With probability at least 1−δ1-\delta,

sup⁡h∈H∣R(h)−R^n(h)∣≤Cdlog⁡(n/d)+log⁡(1/δ)n.\sup_{h\in\Hcal}\big|R(h)-\hat R_n(h)\big| \le C\sqrt{\frac{d\log(n/d)+\log(1/\delta)}{n}} .

The derivation combines symmetrisation, Sauer's lemma applied to the (at most ΠH(2n)\Pi_\Hcal(2n)) labellings on the doubled sample, and Massart's lemma below; it is carried out in the references and the structure is exactly the one reproduced for the Rademacher bound in the next section.

PropositionVC dimension of linear classifiers

Let H={x↦sign⁡(⟨w,x⟩):w∈Rd}\Hcal = \{x\mapsto\sign(\ip{w}{x}) : w\in\R^d\} be the homogeneous halfspaces. Then VC(H)=d\mathrm{VC}(\Hcal)=d. With a bias term, VC=d+1\mathrm{VC}=d+1.

Rademacher complexity

DefinitionRademacher complexity

For a class G\mathcal{G} of functions X→R\Xcal\to\R and a sample S=(x1,…,xn)S = (x_1,\dots,x_n), the empirical Rademacher complexity is

R^S(G)=Eε[sup⁡g∈G1n∑i=1nεig(xi)],\hat{\mathfrak{R}}_S(\mathcal{G}) = \E_\eps\left[\sup_{g\in\mathcal{G}}\frac1n\sum_{i=1}^n\eps_ig(x_i)\right],

with εi\eps_i i.i.d. Rademacher, and the Rademacher complexity is Rn(G)=ESR^S(G)\mathfrak{R}_n(\mathcal{G}) = \E_S\hat{\mathfrak{R}}_S(\mathcal{G}).

TheoremRademacher generalisation bound

Let G\mathcal{G} be a class of functions X→[0,1]\Xcal\to[0,1]. With probability at least 1−δ1-\delta over the sample, simultaneously for all g∈Gg\in\mathcal{G},

Eg≤1n∑i=1ng(xi)+2Rn(G)+log⁡(1/δ)2n.\E g \le \frac1n\sum_{i=1}^ng(x_i) + 2\mathfrak{R}_n(\mathcal{G}) + \sqrt{\frac{\log(1/\delta)}{2n}} .

Key idea

Two ingredients, each from an earlier page: McDiarmid to concentrate the uniform deviation around its mean, and symmetrisation to bound that mean. The decomposition is worth remembering because it localises the difficulty: the concentration step is universal and cheap, and all the class-specific work is in bounding Rn\mathfrak{R}_n.

LemmaMassart's finite lemma

Let A⊆RnA\subseteq\R^n be finite with ∥a∥2≤r\norm{a}_2\le r for all a∈Aa\in A. Then

Eε[max⁡a∈A⟨ε,a⟩]≤r2log⁡∣A∣.\E_\eps\left[\max_{a\in A}\ip{\eps}{a}\right] \le r\sqrt{2\log|A|} .

Applying Massart with A=H∣S⊆{±1}nA = \Hcal|_S \subseteq\{\pm1\}^n, so r=nr = \sqrt n and ∣A∣≤ΠH(n)≤(en/d)d|A| \le \Pi_\Hcal(n) \le (en/d)^d, gives

R^S(H)≤n2dlog⁡(en/d)n=2dlog⁡(en/d)n,\hat{\mathfrak{R}}_S(\Hcal) \le \frac{\sqrt n\sqrt{2d\log(en/d)}}{n} = \sqrt{\frac{2d\log(en/d)}{n}},

which recovers the VC bound. So the Rademacher route subsumes the combinatorial one.

PropositionRademacher complexity of a norm-bounded linear class

Let G={x↦⟨w,x⟩:∥w∥2≤B}\mathcal{G} = \{x\mapsto\ip{w}{x} : \norm{w}_2\le B\} and suppose ∥xi∥2≤R\norm{x_i}_2\le R. Then

R^S(G)≤BRn.\hat{\mathfrak{R}}_S(\mathcal{G}) \le \frac{BR}{\sqrt n} .

The bound does not depend on the dimension of xx.

Key idea

This is the single most important capacity bound in the subject, and the reason margin-based methods work in high dimension. The complexity is controlled by ∥w∥2∥x∥2\norm{w}_2\norm{x}_2, not by the dimension. So a linear classifier in R106\R^{10^6} with small norm is a low-capacity object, while the VC dimension of the unconstrained class is 10610^6. The SVM margin bound is this proposition plus the contraction lemma, and the same mechanism is what norm-based bounds for neural networks attempt to exploit.

LemmaTalagrand contraction

If ϕ:R→R\phi:\R\to\R is KK-Lipschitz then R^S(ϕ∘G)≤K R^S(G)\hat{\mathfrak{R}}_S(\phi\circ\mathcal{G}) \le K\,\hat{\mathfrak{R}}_S(\mathcal{G}).

Quoted from Ledoux–Talagrand via the references. It is the tool that converts a bound on the complexity of the predictor class into a bound on the complexity of the loss class: the hinge loss is 11-Lipschitz, the logistic loss is 11-Lipschitz, and a ramp surrogate for the zero-one loss at margin γ\gamma is 1/γ1/\gamma-Lipschitz — whence the 1/γ1/\gamma in every margin bound.

Two other routes to generalisation

DefinitionUniform stability

An algorithm A\mathcal{A} is β\beta-uniformly stable if for every pair of samples S,S′S, S' differing in one point, and every (x,y)(x,y),

∣ℓ(A(S)(x),y)−ℓ(A(S′)(x),y)∣≤β.\big|\ell(\mathcal{A}(S)(x),y) - \ell(\mathcal{A}(S')(x),y)\big| \le \beta .

Bousquet and Elisseeff show that such an algorithm satisfies E[R(A(S))−R^n(A(S))]≤β\E[R(\mathcal{A}(S)) - \hat R_n(\mathcal{A}(S))]\le\beta, and that regularised ERM with a λ\lambda-strongly convex regulariser is O(1/(λn))O(1/(\lambda n))-stable.

DefinitionPAC-Bayes bound

For a prior PP over hypotheses fixed before seeing the data and any posterior QQ (possibly data-dependent), with probability at least 1−δ1-\delta,

Eh∼QR(h)≤Eh∼QR^n(h)+KL(Q ∥ P)+log⁡(2n/δ)2n.\E_{h\sim Q}R(h) \le \E_{h\sim Q}\hat R_n(h) + \sqrt{\frac{\mathrm{KL}(Q\,\|\,P) + \log(2\sqrt n/\delta)}{2n}} .

Both are algorithm-dependent, which is what makes them candidates for explaining deep learning where uniform convergence fails: stability speaks about what the optimiser does, and PAC-Bayes charges only for the information the posterior adds to the prior. Neither has yet produced a non-vacuous bound for a state-of-the-art network trained on a standard benchmark, which is the honest state of the art.

Problems

Prove the Sauer–Shelah lemmaProof · Graduate · 3 hours VC dimension of halfspacesProof · Intermediate · 30 min A one-parameter class with infinite VC dimensionProof · Advanced · 1 hour Massart's finite maximal inequalityProof · Advanced · 30 min Rademacher complexity of a norm-bounded linear classProof · Advanced · 30 min Derive the margin generalisation boundProof · Graduate · 1 hour

References

  • BookShai Shalev-Shwartz and Shai Ben-David (2014). Understanding Machine Learning: From Theory to Algorithms
  • BookMehryar Mohri, Afshin Rostamizadeh and Ameet Talwalkar (2018). Foundations of Machine Learning
  • PaperPeter L. Bartlett and Shahar Mendelson (2002). Rademacher and Gaussian Complexities: Risk Bounds and Structural Results
  • PaperDavid A. McAllester (1999). Some PAC-Bayesian Theorems
  • PaperOlivier Bousquet and André Elisseeff (2002). Stability and Generalization

These works are cited as sources to read, not reproduced. All exposition, examples and problems on this site are written independently; where an argument is standard, the citation points to a canonical treatment.

Results stated on this page

Problems (6)

All problems