Tutorials › Statistical Learning (Graduate) › VC Bounds for Realizable ERM

ERM Consistency and Rates · Tutorial 205 of 989

VC Bounds for Realizable ERM

See how VC dimension controls the population error of a consistent classifier, and derive the resulting high-probability guarantee.

Intermediate 12 min read

What You'll Learn

  • Define the growth function and VC dimension for binary classifiers.
  • State realizability and connect it to zero empirical risk almost surely.
  • Prove a double-sample VC growth-function bound for consistent hypotheses.
  • Apply the Sauer–Shelah lemma to expose the dependence on VC dimension.
  • Calculate population-error guarantees in threshold, interval, and finite-domain examples.
  • Recognize why the growth-function argument counts traces on a pooled sample.

From Consistency to Population Error

In realizable binary classification, at least one hypothesis in the class predicts the label correctly with probability one. An empirical risk minimizer can therefore fit the observed sample perfectly, but zero training error alone does not say how well it predicts new observations. The VC growth function controls the number of distinct prediction patterns the class can produce, and hence how many different ways a consistent classifier can adapt to the sample.

Let \(\mathcal X\) be a feature space, let \(\mathcal H\) be a class of functions \(h:\mathcal X\to\{0,1\}\), and let \((X,Y)\) have distribution \(P\) on \(\mathcal X\times\{0,1\}\). For \(h\in\mathcal H\), define its population risk and the empirical risk on an iid sample \((X_i,Y_i)_{i=1}^n\) by

$$ R(h)=P(h(X)\ne Y),\qquad \widehat R_n(h)=\frac{1}{n}\sum_{i=1}^n \mathbf 1\{h(X_i)\ne Y_i\}. $$

A set of \(m\) points is shattered by \(\mathcal H\) if the restrictions of its hypotheses realize every one of the \(2^m\) binary labelings of those points. The VC dimension \(d\) is the largest size of a shattered set, or infinity if there is no largest finite size. The growth function counts the largest number of different prediction patterns the class can make on any \(m\) points.

Definition: For \(x_1,\ldots,x_m\in\mathcal X\), the prediction patterns are the vectors \((h(x_1),\ldots,h(x_m))\), \(h\in\mathcal H\). The growth function is \(\Pi_{\mathcal H}(m)=\max_{x_1,\ldots,x_m}|\{(h(x_1),\ldots,h(x_m)):h\in\mathcal H\}|\). Thus \(\Pi_{\mathcal H}(m)\le 2^m\); if \(\mathcal H\) has VC dimension \(d\), the Sauer–Shelah lemma gives \(\Pi_{\mathcal H}(m)\le\sum_{j=0}^d {m\choose j}\).

We assume the relevant events are measurable (for example, \(\mathcal H\) is countable or satisfies the usual separability conditions). A probability statement about all consistent hypotheses requires this condition; without it, the same bound can be stated using outer probability.

The Realizable VC Bound

The central result controls the probability that any hypothesis consistent with the sample has population risk greater than \(\varepsilon\). Consequently, it applies to any measurable ERM selection, including one whose choice among empirical minimizers depends on the data.

Theorem (realizable VC growth-function bound): Suppose \(\mathcal H\) is a binary hypothesis class, \(n\ge1\), and \(0<\varepsilon\le1\) with \(n\varepsilon\ge8\log 2\). Then \[ P\bigl(\exists h\in\mathcal H:\widehat R_n(h)=0,\ R(h)>\varepsilon\bigr) \le 2\Pi_{\mathcal H}(2n)\exp(-n\varepsilon/4). \] In particular, if the problem is realizable and \(\hat h\) is an ERM, the same upper bound applies to \(P(R(\hat h)>\varepsilon)\).

Here is the double-sample argument. Write \(A\) for the event that some consistent \(h\) has \(R(h)>\varepsilon\). Draw an independent ghost sample \((X'_i,Y'_i)_{i=1}^n\) from \(P\). For any fixed witness \(h\) to \(A\), the number \(G=\sum_{i=1}^n\mathbf 1\{h(X'_i)\ne Y'_i\}\) has a binomial distribution with mean \(nR(h)>n\varepsilon\). A multiplicative Chernoff bound gives

$$ P(G\le n\varepsilon/2) \le P(G\le nR(h)/2) \le \exp\{-nR(h)/8\} \le \exp\{-n\varepsilon/8\} \le \frac12. $$

Thus, conditional on the original sample and a witness to \(A\), the ghost sample has more than \(n\varepsilon/2\) errors for that witness with probability at least \(1/2\). If \(B\) is the event that some \(h\) makes no errors on the original sample and more than \(n\varepsilon/2\) errors on the ghost sample, then \(P(A)\le2P(B)\).

To bound \(P(B)\), regard the \(2n\) observations as pooled and choose \(n\) of them uniformly for the original sample; the remaining \(n\) form the ghost sample. This random split has the same distribution as the two independent samples. For any fixed hypothesis, its error locations among the pooled observations form a trace. If that trace has \(m>n\varepsilon/2\) locations, the probability that the first half avoids all of them is at most \(2^{-m}\): for \(m\le n\), the probability all \(m\) specified locations fall in the second half is

$$ \frac{{n\choose m}}{{2n\choose m}} =\prod_{j=0}^{m-1}\frac{n-j}{2n-j} \le 2^{-m}, $$

and for \(m>n\) it is zero. On the pooled feature points, the number of distinct error traces is at most \(\Pi_{\mathcal H}(2n)\), since the observed labels are fixed and each hypothesis's errors are determined by its predictions. A union bound over these traces yields

$$ P(B)\le \Pi_{\mathcal H}(2n)2^{-n\varepsilon/2} \le \Pi_{\mathcal H}(2n)\exp(-n\varepsilon/4), $$

where \(\log 2>1/2\). Combining this with \(P(A)\le2P(B)\) proves the bound. In a realizable problem there is an \(h^*\in\mathcal H\) with \(R(h^*)=0\). It has zero empirical risk almost surely, so every ERM has zero empirical risk almost surely. The event \(R(\hat h)>\varepsilon\) is therefore contained, up to a null event, in \(A\). \(\square\)

Substituting the VC Dimension

The growth function turns the theorem into a bound involving only the VC dimension. For completeness, the Sauer–Shelah estimate can be obtained by induction on the number \(m\) of points. Split the patterns on \(m\) points according to their restrictions to the first \(m-1\). Let \(B\) be the family of restrictions that occur at least once and \(C\) the restrictions that occur with both possible labels at the last point. The original family has \(|B|+|C|\) patterns. The VC dimension of \(B\) is at most \(d\), while \(C\) has VC dimension at most \(d-1\): if it shattered \(d\) points, the two extensions at the last point would make the original family shatter \(d+1\) points. Induction, with the empty set and dimension-zero cases as bases, gives

$$ \Pi_{\mathcal H}(m)\le \sum_{j=0}^{d}{m\choose j}. $$

For \(1\le d\le m\), this sum is at most \((em/d)^d\). Indeed, put \(x=d/m\le1\). Since \(x^j\ge x^d\) for \(j\le d\),

$$ x^d\sum_{j=0}^{d}{m\choose j} \le \sum_{j=0}^{m}{m\choose j}x^j =(1+x)^m \le e^{mx}=e^d. $$

Consequently, for \(d\ge1\), \(d\le2n\), and \(0<\delta\le1/2\), the theorem implies

$$ P\left( R(\hat h)> \min\left\{1,\frac{4}{n} \left[d\log\left(\frac{2en}{d}\right)+\log\left(\frac{2}{\delta}\right)\right]\right\} \right)\le\delta. $$

If the expression inside the minimum is at least one, the assertion is simply the trivial fact that risk is at most one. Otherwise, take \(\varepsilon\) equal to that expression without the minimum: the growth-function bound is at most \(\delta\), and \(n\varepsilon\ge4\log(2/\delta)\ge8\log2\), so the theorem's condition holds. For \(d=0\), all hypotheses agree on every point (a disagreement at one point would shatter a singleton); realizability then gives zero risk almost surely.

The resulting order is \(O((d\log(en/d)+\log(1/\delta))/n)\), for \(1\le d\le2n\). The factor inside the logarithm matters: the displayed Sauer–Shelah substitution gives \(d\log(2en/d)\), which includes a term of order \(d\). It should not be replaced by \(d\log(n/d)\) without an additional restriction on \(n/d\).

Worked Bounds

Worked Example: Threshold Classifiers

Consider classifiers on the real line of the form \(h_t(x)=\mathbf 1\{x\ge t\}\), with \(t\in\mathbb R\). Two ordered points can receive the patterns \((0,0),(0,1),(1,1)\), but not \((1,0)\), so no two-point set is shattered. A single point can receive either label by choosing \(t\) on the appropriate side. The VC dimension is therefore \(d=1\).

For \(n=1000\) and \(\delta=0.05\), the bound is

$$ \frac{4}{1000}\left[\log(2e\cdot1000)+\log(40)\right] =\frac{4}{1000}(8.601+3.689) \approx0.0492. $$

The condition is satisfied because \(n\varepsilon\approx49.2>8\log2\approx5.55\). Thus every consistent ERM has population error at most about \(0.0492\) with probability at least \(0.95\), under realizability.

Worked Example: Intervals on the Line

Let \(\mathcal H\) consist of indicators of intervals, \(h_{a,b}(x)=\mathbf 1\{a\le x\le b\}\), allowing the empty set as well. Three ordered points cannot be shattered: the pattern that labels the first and third points positive but the middle point negative cannot be produced by an interval. Two points can be shattered, so \(d=2\).

With \(n=500\) and \(\delta=0.05\), the dimension-based bound is

$$ \frac{4}{500}\left[2\log\left(\frac{2e\cdot500}{2}\right)+\log(40)\right] =\frac{4}{500}\left[2\log(1359.14)+\log(40)\right] \approx\frac{4}{500}(14.429+3.689) \approx0.1449. $$

Here \(n\varepsilon\approx72.5\), comfortably above \(8\log2\). The guarantee is distribution-free: it does not require the feature distribution to be uniform or continuous.

Worked Example: A Finite Domain with Exact Growth

Let the feature space have four points and let \(\mathcal H\) contain every binary labeling of those points. The class has VC dimension \(4\), and its growth function is exactly \(\Pi_{\mathcal H}(m)=2^{\min(m,4)}\). For \(n=100\), use the growth-function theorem directly, rather than the looser Sauer–Shelah estimate. With \(\delta=0.1\), choose

$$ \varepsilon=\frac{4}{100}\log\left(\frac{2\cdot 16}{0.1}\right) =0.04\log(320) \approx0.2307. $$

Then \(n\varepsilon\approx23.1>8\log2\), and \(2\Pi_{\mathcal H}(200)\exp(-n\varepsilon/4) =32\exp(-\log320)=0.1\). Thus the population error is at most about \(0.231\) with probability at least \(0.9\). Using the exact growth function can be substantially sharper than its general VC-dimension upper bound.

Why the Growth Function Matters

For a finite class, one can union-bound over its fixed hypotheses. That argument depends on the number of hypotheses being finite and can be very crude when many hypotheses make identical predictions on the observed points. VC theory instead controls the number of distinct patterns on the pooled sample. The ghost sample is essential to this step: it lets us count traces on \(2n\) points while detecting hypotheses that fit one half but make many errors on the other.

The theorem is a high-probability, realizable guarantee; it does not claim that all consistent classifiers have small error on every sample. Its useful range is when \(n\) is large relative to the complexity and the desired error level. If the resulting upper bound exceeds one, the inequality remains valid but gives no informative improvement over the universal risk bound.

  • Pitfall: claiming zero empirical risk on every sample. From \(R(h^*)=0\), it does not follow that every conceivable sample avoids every error point. It follows that each sampled observation is correct almost surely, and hence the full finite sample is correct almost surely.
  • Pitfall: union-bounding over an infinite class as if it were finite. There may be infinitely many hypotheses even when their number of patterns on a sample is limited. The proof counts pooled-sample traces, not hypotheses themselves.
  • Pitfall: dropping the additive contribution inside the rate. Sauer–Shelah gives \(d\log(2en/d)\), not \(d\log(n/d)\) uniformly over \(n\ge d/2\). In particular, at \(n=d\) the former is positive while the latter vanishes.
Key takeaway: In a realizable binary problem, ERM is consistent almost surely. The VC growth function bounds the probability that any consistent hypothesis has large population risk; Sauer–Shelah then yields a guarantee of order \((d\log(en/d)+\log(1/\delta))/n\) in its informative regime.

Check Your Understanding

Use the definitions and bounds above to answer the following.

  1. Why does realizability imply that every ERM has zero empirical risk almost surely, rather than on every conceivable sample?
  2. What does it mean for a set of points to be shattered, and how does that definition determine VC dimension?
  3. In the double-sample proof, why is the growth function evaluated at \(2n\) rather than \(n\)?
  4. For \(d=1\), \(n=200\), and \(\delta=0.1\), write the Sauer–Shelah population-error bound before evaluating it numerically.
  5. Why can the term \(d\log(2en/d)\) not be replaced uniformly by \(d\log(n/d)\)?
Clinical Biostats