Why Realizability Changes the Guarantee
A classifier chosen to make few errors on a training sample need not make few errors on new observations. For a finite class, probability bounds quantify this gap. Under zero-one loss, a crucial distinction is whether the class contains a classifier with no population errors. When it does, an empirical risk minimizer that makes no training errors has a faster guarantee than the general guarantee available without that assumption.
The faster conclusion is not a property of zero-one loss alone: it depends on realizability. Without realizability, a classifier may make unavoidable errors even with unlimited data, and finite-class selection generally has a slower, square-root sample-size rate unless additional structure is available.
Setup and Definitions
Let \((X,Y)\) have a fixed distribution \(P\), where \(Y\in\{0,1\}\), and let \((X_1,Y_1),\ldots,(X_n,Y_n)\) be independent observations with this distribution. Let \(\mathcal H\) be a nonempty finite class of measurable classifiers \(h:\mathcal X\to\{0,1\}\), and write \(M=|\mathcal H|\). The zero-one loss is one for an incorrect prediction and zero otherwise.
The minimum population risk \(R^*_{\mathcal H}=\min_{h\in\mathcal H}R(h)\) is the best risk available within the class. It need not be zero. In the agnostic setting, a useful guarantee compares the selected classifier with this in-class oracle, rather than with an unattainable error-free classifier.
Worked Example: Selecting From Observed Error Counts
Suppose \(n=8\), and three candidate classifiers make the following errors on the observed sample. Classifier \(A\) errs on observations 2 and 7; classifier \(B\) errs on observations 1, 4, and 8; classifier \(C\) errs on observations 3, 5, and 6.
The empirical risks are $$ \widehat R_8(A)=\frac{2}{8}=0.25,\qquad \widehat R_8(B)=\frac{3}{8}=0.375,\qquad \widehat R_8(C)=\frac{3}{8}=0.375. $$ Therefore \(A\) is the unique empirical risk minimizer. These counts establish which classifier empirical selection chooses; by themselves, they do not establish any of the three population risks. A probability guarantee needs the sampling assumptions and the appropriate realizability or agnostic argument.
The Realizable Case: A \(1/n\)-Scale Bound
When some candidate has zero population risk, it makes no errors on any individual drawn from \(P\), with probability one. Thus the minimum empirical risk is zero for every sample, except on a probability-zero event. Every empirical risk minimizer is then consistent: it also has zero training errors. The question is how large its population risk could still be.
Proof. Choose \(h_0\in\mathcal H\) with \(R(h_0)=0\). Each training observation is classified correctly by \(h_0\) with probability one, so \(\widehat R_n(h_0)=0\) with probability one. Since empirical risks are nonnegative, every empirical risk minimizer has empirical risk zero with probability one.
Fix \(\varepsilon>0\). If \(R(\hat h)>\varepsilon\), then some \(h\in\mathcal H\) has \(R(h)>\varepsilon\) and makes no errors on the sample. For any fixed \(h\), independence gives $$ P\{\widehat R_n(h)=0\}=(1-R(h))^n\le e^{-nR(h)}. $$ For every \(h\) with \(R(h)>\varepsilon\), this probability is at most \(e^{-n\varepsilon}\). Taking a union bound over at most \(M\) classifiers yields $$ P\{R(\hat h)>\varepsilon\}\le M e^{-n\varepsilon}. $$ Set \(\varepsilon=\log(M/\delta)/n\). Then \(M e^{-n\varepsilon}=\delta\), proving the claim. \(\square\)
Worked Example: A Realizable Risk Guarantee
Let the class contain \(M=12\) classifiers, suppose it is realizable, and take \(n=80\) observations. For confidence level \(1-\delta=0.95\), the bound is $$ \frac{\log(M/\delta)}{n} =\frac{\log(12/0.05)}{80} =\frac{\log(240)}{80} \approx\frac{5.4806}{80} \approx 0.0685. $$ Thus every empirical risk minimizer has population risk at most about \(6.85\%\) with probability at least \(95\%\). This conclusion relies on a candidate having exactly zero population risk, not merely a small risk.
The Agnostic Case: A Slow-Rate Oracle Bound
Without realizability, there may be no zero-risk classifier, and the empirical minimizer need not be consistent. A general finite-class guarantee instead controls how far each candidate's empirical risk can deviate from its population risk. It then compares the selected classifier with the best population-risk candidate.
Proof. For each fixed \(h\), the \(n\) loss values \(\mathbf 1\{h(X_i)\ne Y_i\}\) are independent, lie in \([0,1]\), and have mean \(R(h)\). Hoeffding's inequality therefore gives $$ P\{|\widehat R_n(h)-R(h)|>t\}\le 2e^{-2nt^2}. $$ A union bound over \(\mathcal H\) shows that the probability of any candidate violating this deviation bound is at most \(2M e^{-2nt^2}=\delta\). On the complementary event, \(|\widehat R_n(h)-R(h)|\le t\) for every \(h\in\mathcal H\).
Choose \(h^*\in\mathcal H\) minimizing \(R(h)\), which exists because the class is finite. On that same event, use the deviation inequality first for \(\hat h\), then empirical minimization, and then for \(h^*\): $$ R(\hat h) \le \widehat R_n(\hat h)+t \le \widehat R_n(h^*)+t \le R(h^*)+2t. $$ This is the stated bound. \(\square\)
Worked Example: An Agnostic Oracle Comparison
Let \(M=5\), \(n=200\), and \(\delta=0.10\). Then $$ t=\sqrt{\frac{\log(2\cdot 5/0.10)}{2\cdot 200}} =\sqrt{\frac{\log(100)}{400}} \approx \sqrt{0.01151} \approx 0.1073. $$ The excess-risk term is \(2t\approx0.2146\). If the best population risk in the class is \(0.12\), the theorem gives \(R(\hat h)\le 0.12+0.2146=0.3346\) with probability at least \(90\%\). The comparison is to the best candidate's risk, not to zero.
Worked Example: Comparing Sample-Size Scales
Consider a class of \(M=1000\) classifiers and confidence \(1-\delta=0.95\). In the realizable case, to make the stated upper bound at most \(0.02\), it is sufficient that $$ \frac{\log(1000/0.05)}{n}\le 0.02, \qquad n\ge \frac{\log(20000)}{0.02} \approx 495.1. $$ Thus \(n=496\) suffices for that bound.
For the agnostic theorem to give an excess-risk bound of at most \(0.10\), it is sufficient that \(2t\le0.10\). Therefore $$ 2\sqrt{\frac{\log(2\cdot1000/0.05)}{2n}}\le0.10 \quad\Longleftrightarrow\quad n\ge\frac{\log(40000)}{0.005} \approx2119.3. $$ Thus \(n=2120\) suffices for this agnostic guarantee. These are sufficient sample sizes for the displayed bounds, not claims that those sample sizes are necessary in every classification problem.
Interpreting the Difference
The realizable bound decreases on the scale \(\log(M/\delta)/n\), whereas the general agnostic excess-risk bound decreases on the scale \(\sqrt{\log(M/\delta)/n}\). The difference arises in the proof: in the realizable case, a classifier with risk \(r\) must make zero errors for the empirical minimizer to select it, an event whose probability is at most \(e^{-nr}\). In the agnostic case, the argument must control deviations of empirical risks around their means, leading to a square-root term.
These guarantees are uniform over the finite class and can be used without knowing the particular distribution \(P\), provided the stated assumptions hold. The bounds may be conservative: they depend on the size of the whole class and do not exploit additional structure that might make selection easier. In particular, do not read the agnostic result as saying that every problem needs a square-root rate; stronger rates require further conditions.
Common Mistake
A common error is to use the realizable bound just because an empirical minimizer makes no training errors. That observation only says the selected classifier fits this sample. It does not imply that any classifier in the class has zero population risk. Without that population-level assumption, the union-bound argument for the faster rate does not apply. Use the agnostic oracle bound unless realizability is justified. Conversely, the realizable theorem guarantees small risk for a consistent empirical minimizer; it does not say every classifier in the class is accurate.
Check Your Understanding
Use the assumptions carefully when choosing a bound.
- State the realizability assumption in terms of the population risks of classifiers in \(\mathcal H\).
- Why does the realizable proof bound the probability that a classifier with risk above \(\varepsilon\) makes no training errors?
- For \(M=8\), \(n=100\), and \(\delta=0.05\), write the realizable upper bound before evaluating it numerically.
- In the agnostic theorem, what quantity is the empirical risk minimizer's risk compared with?
- A selected classifier has zero training errors, but no zero-risk classifier is known to exist. Which theorem is justified without further assumptions, and why?