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

ERM Consistency and Rates · Tutorial 206 of 989

VC Bounds for Agnostic ERM

Use a VC uniform-deviation inequality to bound how far binary ERM can fall short of the best risk available in its hypothesis class.

Intermediate 12 min read

What You'll Learn

  • Define binary population risk, empirical risk, and best-in-class risk
  • Relate VC dimension to the growth function of the zero-one loss class
  • Use a VC uniform-deviation bound to obtain a high-probability excess-risk bound
  • Prove why ERM’s excess risk is at most twice the uniform estimation error
  • Interpret the resulting rate and identify when the bound is vacuous
  • Distinguish estimation error from risk that remains even for the best classifier in the class

From Uniform Deviation to Excess Risk

In binary classification, empirical risk minimization chooses a classifier with the smallest observed error on the training sample. The central question is how much worse its true error can be than the best true error available in the chosen hypothesis class. A VC uniform-deviation bound answers this by controlling, simultaneously over the whole class, the difference between empirical and population error.

This distinction matters when no classifier in the class predicts perfectly. The ERM procedure can select a classifier whose risk is close to the class optimum while that optimum itself is still positive. The bound below concerns the first gap: the excess risk over the best-in-class risk. It does not claim that the best classifier in the class has small risk.

Definition: Let \((X,Y)\) have a distribution on \(\mathcal X\times\{0,1\}\), and let \(Z_i=(X_i,Y_i)\), \(i=1,\ldots,n\), be independent observations with this distribution. A binary hypothesis class \(\mathcal H\) is a collection of functions \(h:\mathcal X\to\{0,1\}\). Its population risk, empirical risk, and best-in-class risk are $$ 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\},\qquad R^*_{\mathcal H}=\inf_{h\in\mathcal H}R(h). $$ An empirical risk minimizer \(\hat h\) satisfies \(\widehat R_n(\hat h)=\inf_{h\in\mathcal H}\widehat R_n(h)\).

We assume that an ERM exists and is measurable, and that the relevant suprema over the class are measurable. These conditions hold, for example, for a finite or countable class; standard measurable-separability conditions are another way to make the probability statements below well-defined. The observations are independent and identically distributed, and the loss is the zero-one loss shown in the definition.

The VC Uniform-Deviation Bound

For a class of binary-valued functions, its growth function counts how many distinct patterns it can produce on a fixed finite set. For classification, the relevant functions are the losses \((x,y)\mapsto\mathbf 1\{h(x)\ne y\}\). Write \(S_{\mathcal H}(m)\) for the largest number of distinct loss patterns this class can produce on any \(m\) points in \(\mathcal X\times\{0,1\}\). If \(\mathcal H\) has finite VC dimension \(d\), this loss class has VC dimension at most \(d\): on any fixed labelled points, each loss pattern is obtained from the classifier’s prediction pattern by flipping coordinates according to the labels. Consequently, it has at most as many patterns as the prediction class on the corresponding inputs.

Theorem (VC uniform-deviation bound): Suppose the binary loss class has growth function \(S_{\mathcal H}\), and the measurability conditions above hold. For every \(\varepsilon>0\) with \(n\varepsilon^2\ge 2\), $$ P\left\{\sup_{h\in\mathcal H}\left|\widehat R_n(h)-R(h)\right|>\varepsilon\right\} \le 4S_{\mathcal H}(2n)\exp\left(-\frac{n\varepsilon^2}{16}\right). $$

Here is a proof with constants included. Introduce an independent sample \(Z'_1,\ldots,Z'_n\), and let \(\widehat R'_n(h)\) be its empirical risk. If the original sample has a classifier whose deviation exceeds \(\varepsilon\), then, conditional on that sample, the ghost-sample estimate for that classifier is within \(\varepsilon/2\) of its population risk with probability at least \(1-1/(n\varepsilon^2)\). Indeed, its variance is at most \(1/(4n)\), so Chebyshev’s inequality bounds the probability of a deviation of at least \(\varepsilon/2\) by \(1/(n\varepsilon^2)\le 1/2\). On the event that the ghost estimate is within \(\varepsilon/2\), the two empirical risks differ by more than \(\varepsilon/2\). Thus

$$ P\left\{\sup_h|\widehat R_n(h)-R(h)|>\varepsilon\right\} \le 2P\left\{\sup_h|\widehat R_n(h)-\widehat R'_n(h)|>\frac{\varepsilon}{2}\right\}. $$

To bound the probability on the right, condition on the \(n\) pairs \((Z_i,Z'_i)\) and independently swap the members of each pair with probability one half. This leaves their joint distribution unchanged. For any fixed loss pattern on the \(2n\) observations, the difference of empirical risks after the swaps has the form \(n^{-1}\sum_{i=1}^n \sigma_i c_i\), where the \(\sigma_i\) are independent random signs and \(c_i\in\{-1,0,1\}\). Since \(\sum_i c_i^2\le n\), Hoeffding’s inequality gives a two-sided tail bound of at most \(2\exp(-n\varepsilon^2/8)\) at threshold \(\varepsilon/2\). There are at most \(S_{\mathcal H}(2n)\) loss patterns on the pooled observations. A union bound therefore gives at most \(2S_{\mathcal H}(2n)\exp(-n\varepsilon^2/8)\) for the ghost-sample event. Combining this with the factor 2 above proves the displayed inequality (with the stated, slightly looser exponent). \(\square\)

The growth function can be bounded using Sauer’s lemma. When the VC dimension \(d\ge1\) and \(2n\ge d\),

$$ S_{\mathcal H}(2n)\le \sum_{j=0}^{d}\binom{2n}{j} \le \left(\frac{2en}{d}\right)^d. $$

The first inequality is the VC growth-function bound; the second is the standard binomial-sum estimate. Together, these inequalities turn a bound in terms of the number of patterns into one in terms of the VC dimension.

Worked Example: Calculating Risks and the Best-in-Class Benchmark

Let \(\mathcal X=\{a,b\}\), with \(P(X=a)=0.7\) and \(P(X=b)=0.3\). Suppose \(P(Y=1\mid X=a)=0.1\) and \(P(Y=1\mid X=b)=0.8\). Let \(\mathcal H\) contain just the two constant classifiers \(h_0(x)=0\) and \(h_1(x)=1\). Calculate their risks and interpret a possible sample.

For \(h_0\), an error occurs when \(Y=1\). Thus \(R(h_0)=0.7(0.1)+0.3(0.8)=0.07+0.24=0.31\). For \(h_1\), an error occurs when \(Y=0\), giving \(R(h_1)=0.7(0.9)+0.3(0.2)=0.63+0.06=0.69\). Therefore \(R^*_{\mathcal H}=0.31\), attained by \(h_0\).

Suppose a sample of size 10 contains seven observations with \(X=a\), one of which has \(Y=1\), and three with \(X=b\), all of which have \(Y=1\). Then \(\widehat R_n(h_0)=4/10=0.4\), while \(\widehat R_n(h_1)=6/10=0.6\). ERM chooses \(h_0\), whose excess risk is \(R(h_0)-R^*_{\mathcal H}=0\). Its empirical error, \(0.4\), differs from its population error, \(0.31\), by \(0.09\). The best-in-class risk is \(0.31\); it is not the same quantity as this sample-dependent estimation discrepancy.

Why the Excess-Risk Bound Has a Factor of Two

Define the uniform deviation \(D_n=\sup_{h\in\mathcal H}|\widehat R_n(h)-R(h)|\). ERM compares classifiers using empirical risks, but the target is population risk. The discrepancy between those two criteria can enter once for the classifier ERM selected and once for the best-in-class benchmark.

Theorem (ERM excess-risk inequality): If \(\hat h\) is an exact empirical risk minimizer and \(D_n\) is finite, then $$ R(\hat h)-R^*_{\mathcal H}\le 2D_n. $$ This conclusion does not require that the infimum \(R^*_{\mathcal H}\) be attained.

To prove it, fix any \(h\in\mathcal H\). Add and subtract the empirical risks:

$$ \begin{aligned} R(\hat h)-R(h) &= [R(\hat h)-\widehat R_n(\hat h)] +[\widehat R_n(\hat h)-\widehat R_n(h)] +[\widehat R_n(h)-R(h)]\\ &\le D_n+0+D_n=2D_n. \end{aligned} $$

The middle term is nonpositive because \(\hat h\) minimizes empirical risk. Taking the infimum over \(h\in\mathcal H\) gives the result. In detail, since \(R(\hat h)\le R(h)+2D_n\) for every \(h\), it follows that \(R(\hat h)\le\inf_h R(h)+2D_n\). \(\square\)

Combining this inequality with the VC deviation bound gives a direct high-probability result. For \(d\ge1\), \(n\ge d\), and \(0<\delta<1\), choose

$$ \varepsilon_{n,\delta} =4\sqrt{\frac{d\log(2en/d)+\log(4/\delta)}{n}}. $$

This choice satisfies \(n\varepsilon_{n,\delta}^2\ge2\). Applying Sauer’s lemma in the VC bound makes its right-hand side at most \(\delta\): the exponential factor cancels \((2en/d)^d\) and leaves \(\delta/4\), multiplied by 4. The ERM inequality then yields

Corollary: Under the assumptions above, with probability at least \(1-\delta\), $$ R(\hat h)-R^*_{\mathcal H} \le 8\sqrt{\frac{d\log(2en/d)+\log(4/\delta)}{n}}. $$

This is a finite-sample upper bound; its right-hand side can exceed 1, in which case it is valid but uninformative because a binary classification risk is at most 1. For fixed \(d\) and \(\delta\), it gives an excess-risk rate of order \(\sqrt{d\log(n/d)/n}\) with this growth-function argument. The displayed rate includes a logarithmic factor and is not a claim that this particular bound is sharp in every setting.

Worked Example: Evaluating a High-Probability Bound

Suppose the VC dimension is \(d=5\), the sample size is \(n=10{,}000\), and the desired confidence is \(1-\delta=0.95\). Evaluate the corollary’s upper bound.

Here \(\delta=0.05\), so \(\log(2en/d)=\log(2e\cdot10{,}000/5)=\log(10{,}873.1)\approx9.294\). Thus \(d\log(2en/d)\approx46.47\), and \(\log(4/\delta)=\log(80)\approx4.382\). The expression inside the square root is therefore approximately \((46.47+4.382)/10{,}000=0.005085\). Its square root is approximately \(0.0713\), so the excess-risk bound is \(8(0.0713)\approx0.57\).

Under the theorem’s assumptions, the probability that ERM’s risk exceeds the best-in-class risk by more than approximately \(0.57\) is at most \(0.05\). This is a valid, nonvacuous bound, but it may be too loose to be practically decisive. A confidence guarantee is not a prediction that the excess risk will actually be near the bound.

Worked Example: A Noisy Sample Can Select the Worse Classifier

Let \(X\) be constant and let \(Y\sim\operatorname{Bernoulli}(0.3)\). Again take \(\mathcal H=\{h_0,h_1\}\), the two constant classifiers. Find the best-in-class risk, then consider a sample of size four containing three ones and one zero.

The risk of \(h_0\) is \(P(Y=1)=0.3\), while the risk of \(h_1\) is \(P(Y=0)=0.7\). Hence \(R^*_{\mathcal H}=0.3\). In the stated sample, \(\widehat R_n(h_0)=3/4\) and \(\widehat R_n(h_1)=1/4\), so ERM chooses \(h_1\), which has excess risk \(0.7-0.3=0.4\).

The probability of exactly three ones in this sample is \(\binom{4}{3}(0.3)^3(0.7)=4(0.027)(0.7)=0.0756\). Thus an ERM with positive excess risk is possible even though a better classifier belongs to the class. The high-probability bound controls how often large deviations can cause such a selection; it does not rule out an unfavorable sample.

Reading the Result Correctly

The excess risk \(R(\hat h)-R^*_{\mathcal H}\) measures the cost of using a data-selected classifier rather than the best classifier in the specified class. It is nonnegative because \(R^*_{\mathcal H}\) is an infimum. The VC argument controls this cost through estimation error: if empirical risks are uniformly close to population risks, empirical minimization cannot select a classifier whose population risk is much worse than the class benchmark.

A common mistake is to read the bound as saying that ERM’s risk is small. The theorem instead says that ERM’s risk is close to \(R^*_{\mathcal H}\). If every classifier in the class performs poorly, then \(R^*_{\mathcal H}\) can itself be large, and the excess-risk bound does not remove that baseline risk. Another mistake is to use a pointwise deviation bound for a single fixed classifier: ERM is selected after looking at the data, so the deviation control must hold uniformly over the class.

The practical message is to keep the two quantities separate: \(R^*_{\mathcal H}\) is the best achievable risk within the class, while \(R(\hat h)-R^*_{\mathcal H}\) is the sample-dependent excess risk. VC dimension controls the latter through the number of label patterns the class can realize, not the absolute predictive quality of the class.

Check Your Understanding

Work through these questions using the definitions and inequalities above.

  1. What is the difference between \(R^*_{\mathcal H}\) and \(R(\hat h)-R^*_{\mathcal H}\)?
  2. In the ERM excess-risk proof, why is the middle empirical-risk difference nonpositive?
  3. Why must a uniform-deviation bound control all classifiers in the class rather than just one fixed classifier?
  4. For \(d=3\), \(n=600\), and \(\delta=0.1\), write the corollary’s excess-risk bound before evaluating it numerically.
  5. Can the corollary imply a small absolute risk when \(R^*_{\mathcal H}\) is large? Explain.
Clinical Biostats