Risk, Bayes Optimality & Excess Risk
The best possible predictor, and how far learned ones fall short.
Every guarantee in classification is, in the end, a statement about one gap: how far a learned classifier's error sits above the Bayes error. This lesson computes that gap exactly, bounds it for plug-in rules, meets the theorems that some rules close it for every distribution while no rate of closing holds for all of them, and characterizes the convex losses whose minimization provably leads to the Bayes classifier.
What you’ll learn
- Prove the excess-risk identity and compute Bayes errors.
- Bound plug-in classifiers by , and show how a margin condition turns an estimation error into an excess risk of order .
- Define consistency and universal consistency, state Stone's theorem and Devroye's no-universal-rate theorem, and connect them to the approximation–estimation trade-off.
- Define classification calibration, compute the -transform of standard surrogates, and turn a bound on surrogate excess risk into a bound on excess 0–1 risk.
The Bayes classifier, exactly
Take binary labels and the regression function . A classifier is a measurable with risk . The Bayes classifier is , its risk is the Bayes error, and is the excess risk of .
Condition on . Predicting is wrong when , predicting is wrong when :
Where and agree, their conditional errors coincide. Where they disagree, pays and pays , so the difference is :
Average over . The integrand is nonnegative, so . The conditional error of is , which gives the formula for .
The weight is the heart of the matter. A wrong decision where is near costs almost nothing; a wrong decision where the label is nearly certain costs almost one full unit. With classes and the same argument gives .
The two classes are equally likely, and given the class the input is Gaussian: and . What is the Bayes error, in percent?
Show the answer
15.9 %
Bayes' rule gives , so predicts exactly when . Each class errs when its input lands on the wrong side of , which for has probability ( is the standard normal distribution function). With class means the Bayes error is : never zero, because the two densities overlap everywhere.
Plug-in rules and the margin
Many classifiers are, at heart, estimates of . Logistic regression, -nearest-neighbor averages and kernel smoothers all output a number , and the plug-in rule predicts . How good must be?
Where , the numbers and lie on opposite sides of (one may equal it), so is at least as close to as to :
Insert this into the excess-risk identity, drop the indicator, and apply Jensen's inequality for the second form:
The bound wastes something: it charges the estimation error everywhere, although mistakes happen only where lands on the wrong side of , and they are cheap where is close to . A margin (or low-noise) condition, in the style of Mammen and Tsybakov (1999) and Tsybakov (2004), limits how much probability sits near the decision boundary: for some and ,
With (and ) it says nothing; large means little mass near the boundary.
Suppose everywhere. By the first step of the proof above, a mistake at forces , and points with cost nothing:
Apply the margin condition with . The general bound is linear in ; with the margin condition the exponent becomes :
Combining margin conditions with smoothness of , Audibert and Tsybakov (2007) showed that plug-in classifiers can attain fast rates, faster than , and in some regimes "super-fast" rates, faster than , with matching minimax lower bounds. This refuted two conjectures of the time: that is the best achievable rate, and that plug-in classifiers generally converge more slowly than classifiers based on empirical risk minimization.
Think first never lies in , and your estimate satisfies everywhere. What is the excess risk of the plug-in classifier? Commit to a number before revealing.
Exactly zero. Where , ; where , . The plug-in rule agrees with everywhere, so the identity gives . The general bound is valid but loose: this is the margin condition at its extreme, with no mass at all within of the boundary.
Consistency without rates
With fixed the rule is not consistent in general. Cover and Hart (1967) showed that, under mild conditions, the 1-nearest-neighbor risk tends to a limit with for two classes: within a factor of two of the Bayes error, but not at it. The Convergence lesson Consistency of Nearest Neighbors proves both results.
Read the two theorems together. Some rules converge to the Bayes error for every distribution, yet for any rule and any rate, however slow, some distribution makes it converge more slowly still, even with noiseless labels. A rate is a statement about a class of distributions: smooth , a margin condition, or inside a class of finite VC dimension. This is the asymptotic twin of the theorem in the Convergence lesson No Free Lunch & Inductive Bias.
In the terms of The Learning Problem, universal consistency forces a trade. The class must grow with so that the approximation error vanishes for every , but slowly enough that the estimation error vanishes too. The -NN rule does this through ; empirical risk minimization does it over a growing sequence of classes, the idea behind sieves and structural risk minimization (Shalev-Shwartz & Ben-David, 2014, chapter 7).
Think first A colleague's new classifier comes with a proof of universal consistency. What does that tell you about its error with examples on your problem?
Nothing quantitative. Universal consistency is a limit statement, and by Devroye's theorem some distributions make any rule converge arbitrarily slowly. To predict the error at a given you need either a rate under assumptions you believe hold, or, more practically, an honest held-out estimate.
Surrogates that lead to Bayes
Now let labels be , let be a score with classifier , and let be a surrogate loss of the margin , with -risk and over all measurable . Everything reduces to a single point , where and the score is one number :
is the best conditional -risk available to a score with the wrong sign, or zero.
| Loss | |||
|---|---|---|---|
| Hinge | |||
| Squared | |||
| Exponential | |||
| Logistic | |||
| Perceptron | : not calibrated |
For the hinge loss on , so the comparison is linear:
For the logistic loss, , so ; for the exponential loss, as well. Either way:
So any procedure that drives the surrogate excess risk to zero is consistent for the 0–1 loss. This is how consistency was established for regularized kernel classifiers such as SVMs (Steinwart, 2005) and for regularized boosting (Lugosi & Vayatis, 2004; Zhang, 2004). The square root costs rate: a surrogate excess risk of order guarantees only order for the 0–1 loss unless a low-noise condition sharpens the comparison, which Bartlett, Jordan and McAuliffe also quantify.
Which of these convex losses of the margin is not classification-calibrated?
- Hinge,
- Exponential,
- Perceptron,
- Logistic,
Show the answer
C. Perceptron,
The perceptron loss has a kink at (slopes and ), so it is not differentiable there and the criterion fails. Directly: the score has zero -risk under every distribution, so minimizing this risk says nothing about the sign. The perceptron algorithm still works on separable data because it stops at a separator, not because of calibration.
Key takeaways
- : the Bayes classifier is optimal, , and mistakes where is near are nearly free.
- A plug-in rule loses at most ; under a margin condition with exponent , a uniform estimation error costs only order .
- Universally consistent rules exist (-NN with and : Stone, 1977), but no rate of convergence holds for every distribution (Devroye, 1982). Every rate is bought with assumptions.
- A surrogate is classification-calibrated when wrong signs cost strictly more conditional risk; a convex is calibrated if and only if exists and is negative. Then , with for the hinge loss and for the logistic and exponential losses.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
At a point with , a classifier predicts . How much does this point contribute to , per unit of probability mass?
Show the answer
B.
The weight is : the classifier errs with conditional probability where the Bayes classifier errs with .
An estimate satisfies . What does the plug-in bound guarantee about the excess risk of ?
- At most
- At most
- At most
- At most
Show the answer
C. At most
. The factor comes from .
Which choice of makes the -nearest-neighbor rule universally consistent?
- for every
- for every
Show the answer
D.
Stone's conditions are and ; satisfies both. Growing averages away the noise, and keeps the neighbors local.
An SVM's excess hinge risk is . What does the comparison inequality guarantee about its excess 0–1 risk?
- At most
- At most
- At most
- At most
Show the answer
A. At most
For the hinge loss , so .
Further reading
- L. Devroye, L. Györfi & G. Lugosi, A Probabilistic Theory of Pattern Recognition (Springer, 1996).
- C. J. Stone, "Consistent nonparametric regression," Annals of Statistics 5(4), 595–620 (1977).
- L. Devroye, "Any discrimination rule can have an arbitrarily bad probability of error for finite sample size," IEEE Transactions on Pattern Analysis and Machine Intelligence PAMI-4(2), 154–157 (1982).
- P. L. Bartlett, M. I. Jordan & J. D. McAuliffe, "Convexity, classification, and risk bounds," Journal of the American Statistical Association 101(473), 138–156 (2006).
- J.-Y. Audibert & A. B. Tsybakov, "Fast learning rates for plug-in classifiers," Annals of Statistics 35(2), 608–633 (2007).