MVA · Course notes

Introduction to Statistical Learning

M2 MVA · Semester 1 · Learning · 5 ECTS

Contents

Introduction and overview

Module Introduction to Statistical Learning
Official title Introduction to statistical learning
Instructors N. VAYATIS (master-mva.com, 2026–2027)
Period Semester 1 · period 1 (28/09/2026 – 08/01/2027)
Credits and volume 5 ECTS · 24 h (lectures 16 h, tutorials 8 h) per the Université Paris-Saclay programme table
Label Learning · domains on master-mva.com: Machine Learning
Language Not displayed (the master-mva.com course description is written in English)
Assessment Part 1: partial exam (mandatory); Part 2: final exam; re-take: written exam or project, proposed only for students who attended Part 1 and Part 2 (master-mva.com, no weights displayed) · Université Paris-Saclay: “Evaluation Continue non Intégrale” (partial continuous assessment)
Prerequisites Undergraduate courses in analysis and probability (master-mva.com)
Note on sources master-mva.com announces 8 theoretical sessions and 3 practical sessions and links to a course web page; the Université Paris-Saclay table gives 16 h of lectures and 8 h of tutorials

Audience: a student with a good M1 in mathematics, computer science or physics who has already called fit and predict on a classifier and now wants to know why, when and how fast learning from examples works.

Empirical first: on a two-class Gaussian problem whose best achievable error is known exactly (15.87 %), the 1-nearest-neighbour rule stays near 22 % however many examples it sees. The k-nearest-neighbour rule with k = \sqrt{n} reaches 15.9 % at n = 10\,000 (code in ch. 3). Why one rule converges to the optimum and the other does not, how fast, and what to do when the optimum is out of reach are the questions of this course.

The course builds the mathematical theory of supervised learning. It defines the learning problems and their optimal predictors, the classical algorithms that approximate them, and the inequalities that say how much data they need. It then studies the two ideas behind most modern classifiers: convex surrogate losses and the aggregation of many simple predictors. It ends with scoring, where one ranks individuals instead of labelling them.

It shares tools with Convex Optimization, Theoretical Foundations of Deep Learning and Statistical Learning with Extreme Values, and prepares Kernel Methods and Sequential Learning.

What you will be able to do

Official objectives and syllabus (2026–2027)

The course description on master-mva.com states a single objective: to present the mathematical foundations of supervised learning. It lists seven themes, announces 8 theoretical sessions and 3 practical sessions, and links to a course web page. The Université Paris-Saclay course detail gives only the type of assessment, with no programme of its own.

Official topic Course section
Typology of learning problems ch. 1: Definition 1.1, the typology table, Definition 1.2; supervised, unsupervised, online and active settings
Statistical models and main algorithms for classification, scoring, … ch. 3 (LDA, logistic regression, perceptron, nearest neighbours, partitions and trees); ch. 6 (SVM and other surrogate minimizers); ch. 7 (bagging, random forests, AdaBoost); ch. 8 (scoring functions, RankBoost, TreeRank)
Performance criteria and inference principles ch. 2: excess risk and consistency (Definition 2.1), cost-sensitive risk (Proposition 2.2), test-set estimation (Proposition 2.3), plug-in, ERM, penalization and maximum likelihood (Propositions 2.4–2.5, Definition 2.6); ROC and AUC in ch. 8
Convex risk minimization ch. 6: Definitions 6.1–6.2, Theorem 6.3 (calibration), Theorem 6.4 (comparison inequality), Lemma 6.6 (contraction), Theorem 6.7 (estimation error)
Complexity measures ch. 4: growth function and VC dimension (Definition 4.3, Lemma 4.6), Rademacher complexity (Definition 4.8, Theorem 4.10, Lemma 4.11, Proposition 4.13)
Aggregation and ensemble methods ch. 7: bagging (Proposition 7.1), random forests (Definition 7.2), AdaBoost (Definition 7.3, Theorem 7.4, Proposition 7.5), margin bound (Theorem 7.7), exponential weights (Theorem 7.8)
Main theorems Theorem 1.3 (Bayes classifier); Theorems 3.3 (perceptron), 3.5 (Stone) and Proposition 3.6 (Cover–Hart); Theorem 4.7 (Vapnik–Chervonenkis); ch. 5: fundamental theorem, no-free-lunch, lower bounds, slow rates, consistency of structural risk minimization; Theorems 6.3–6.4, 7.4, 7.7, 8.3
“Les intervenants” (last item of the list) Not a topic: the heading above the instructor’s name, Nicolas Vayatis (Centre Borelli, ENS Paris-Saclay, as listed on master-mva.com)
Organisation: 8 theoretical sessions Session plan: sessions 1–3, 5–8 and 10
Organisation: 3 practical sessions Session plan: sessions 4, 9 and 11, with the Python code of each chapter
Assessment: partial exam, final exam, re-take Projects and assessment: written exam proposal and projects sized for the re-take

Every official topic is taught on this page. The extensions beyond the syllabus are the review of ch. 0, the theory of bipartite ranking in ch. 8 (an expansion of the “scoring” of the second theme), and two self-study chapters: fast rates, stability and model selection (ch. 9), and research directions (ch. 10).

Where this course fits in the programme

Official prerequisites: undergraduate courses in analysis and probability. The course also uses a little convexity; ch. 0 reviews everything that is needed.

Course outline

Session plan

24 h in class = 11 sessions (9 × 2 h + 2 × 3 h). The volume is the official one of the Université Paris-Saclay programme table: 16 h of lectures and 8 h of tutorials. master-mva.com announces 8 theoretical sessions and 3 practical sessions; the plan below turns them into 8 lectures of 2 h and 3 practical sessions of 3 h, 2 h and 3 h. This split, and the content of each session, is a proposal.

Level 1 = foundations, 2 = core results and algorithms, 3 = advanced and research-level material. The level never goes down from one session to the next.

Session Hours Level Content Practice
1 2 h 1 ch. 0 Review (0.1–0.6); ch. 1 Learning problems, typology, Bayes classifier and regression function (1.1–1.5) Ex. 2
2 2 h 1 ch. 2 Excess risk, consistency, cost-sensitive risk, test-set estimation; plug-in, ERM, penalization, maximum likelihood (2.1–2.7) Ex. 1, 3, 7
3 2 h 2 ch. 3 LDA, logistic regression, perceptron, nearest neighbours, Stone’s theorem, Cover–Hart, partitions and trees (3.1–3.8) Ex. 8
4 3 h 2 ch. 3 Practical session 1: Bayes risk of Gaussian models, k-NN consistency experiment, trees; exercises on ch. 1–3 Ex. 6; lab: code of ch. 1 and 3
5 2 h 2 ch. 4 Finite classes, growth function, VC dimension, Sauer’s lemma, VC inequality (4.1–4.7) Ex. 4, 10
6 2 h 2 ch. 4 McDiarmid’s inequality, Rademacher complexity, the symmetrization bound, Massart’s lemma, linear classes (4.8–4.14) Ex. 9
7 2 h 2 ch. 5 PAC learnability, fundamental theorem, no free lunch, lower bounds, slow rates, structural risk minimization (5.1–5.8) Ex. 16
8 2 h 2 ch. 6 Surrogate losses, calibration, comparison inequalities, contraction, estimation error (6.1–6.8) Ex. 5, 11
9 2 h 2 ch. 6 Practical session 2: computing \psi-transforms, Rademacher bounds versus test errors, surrogate minimizers in Python lab: code of ch. 4 and 6
10 2 h 3 ch. 7 Bagging, random forests, AdaBoost, margin bound, exponential weights (7.1–7.8) Ex. 12, 14
11 3 h 3 ch. 8 Practical session 3, taught as a guided tutorial: ROC, AUC, optimal scoring, empirical AUC as a U-statistic (8.1–8.7); lab on ensembles and AUC Ex. 13, 17; lab: code of ch. 7 and 8

Self-study, outside the 24 h (about 6 h in total): ch. 9 Complements: margin conditions and fast rates, Bernstein’s inequality, hold-out selection, stability (≈ 3 h, with Ex. 7 and 15) · ch. 10 Research directions and open problems (≈ 3 h).

How to study this module

0. Review: conditional expectation, concentration and convexity

Three M1 tools carry the whole course: conditional expectation defines the optimal predictors, concentration inequalities control the gap between empirical and true risks, and convexity makes risks computable. This chapter states them in the form used later.

The Probability and Statistics refresher covers the same ground at a slower pace.

Conditional expectation

Definition 0.1 — Regression function Let (X, Y) be a random pair with X \in \mathcal{X} and \mathbb{E}|Y| < \infty. The regression function is the measurable function \eta(x) = \mathbb{E}[\, Y \mid X = x \,] . It satisfies the tower property: \mathbb{E}[\eta(X)\, h(X)] = \mathbb{E}[Y\, h(X)] for every bounded measurable h.

Proposition 0.2 — Pythagoras for conditional expectation If \mathbb{E}\, Y^2 < \infty, then for every measurable f with \mathbb{E}\, f(X)^2 < \infty, \mathbb{E}\big[(Y - f(X))^2\big] = \mathbb{E}\big[(Y - \eta(X))^2\big] + \mathbb{E}\big[(\eta(X) - f(X))^2\big] .

Proof. Write Y - f(X) = (Y - \eta(X)) + (\eta(X) - f(X)) and expand the square.

The cross term is 2\,\mathbb{E}[(Y - \eta(X))\, h(X)] with h = \eta - f. It vanishes by the tower property, extended from bounded to square-integrable h by truncation. ∎

Concentration of sums

Proposition 0.3 — Markov and Chebyshev If Z \geq 0 and t > 0, then \mathbb{P}(Z \geq t) \leq \mathbb{E} Z / t. Applied to (Z - \mathbb{E}Z)^2, it gives \mathbb{P}(|Z - \mathbb{E} Z| \geq t) \leq \frac{\mathrm{Var}(Z)}{t^2} .

For a mean of n independent variables, Chebyshev gives a deviation probability of order 1/(n t^2). Learning needs much more: an exponential decay, so that a union bound over many predictors stays small.

Lemma 0.4 — Hoeffding’s lemma If a \leq Z \leq b almost surely and \mathbb{E} Z = 0, then for every \lambda \in \mathbb{R}, \mathbb{E}\, e^{\lambda Z} \leq \exp\Big(\frac{\lambda^2 (b - a)^2}{8}\Big) .

Proof. By convexity of z \mapsto e^{\lambda z} on [a, b], e^{\lambda z} \leq \frac{b - z}{b - a}\, e^{\lambda a} + \frac{z - a}{b - a}\, e^{\lambda b} .

Take expectations with \mathbb{E}Z = 0, and set p = -a/(b - a) and h = \lambda (b - a). The bound becomes e^{L(h)} with L(h) = -hp + \log\big(1 - p + p\, e^h\big) .

One checks L(0) = L'(0) = 0 and L''(h) = u(1 - u) \leq 1/4, where u = p e^h / (1 - p + p e^h).

Taylor’s formula gives L(h) \leq h^2 / 8. ∎

Theorem 0.5 — Hoeffding’s inequality Let Z_1, \dots, Z_n be independent with a_i \leq Z_i \leq b_i, and let S = \sum_i (Z_i - \mathbb{E} Z_i). For every t > 0, \mathbb{P}(S \geq t) \leq \exp\Big(-\frac{2 t^2}{\sum_{i=1}^n (b_i - a_i)^2}\Big) .

Proof. For \lambda > 0, Markov’s inequality applied to e^{\lambda S} and independence give \mathbb{P}(S \geq t) \leq e^{-\lambda t} \prod_{i=1}^n \mathbb{E}\, e^{\lambda (Z_i - \mathbb{E} Z_i)} \leq \exp\Big(-\lambda t + \frac{\lambda^2}{8} \sum_i (b_i - a_i)^2\Big), by Lemma 0.4. The choice \lambda = 4t / \sum_i (b_i - a_i)^2 minimizes the exponent. ∎

Key result — Hoeffding for a mean of [0, 1] variables \mathbb{P}\big(|\bar Z_n - \mathbb{E} Z| \geq \varepsilon\big) \leq 2\, e^{-2 n \varepsilon^2} \quad\Longleftrightarrow\quad |\bar Z_n - \mathbb{E} Z| \leq \sqrt{\frac{\log(2/\delta)}{2n}} \ \text{ with probability} \geq 1 - \delta .

The union bound completes the toolkit: for any events A_1, \dots, A_N, \mathbb{P}(A_1 \cup \dots \cup A_N) \leq \sum_{j=1}^N \mathbb{P}(A_j) . With N predictors, it costs a factor N in probability, hence only \log N inside the square root.

Example 0.6 — How precise is a test error? A classifier makes 120 mistakes on n = 1000 independent test points. Each mistake indicator lies in [0, 1], so with \delta = 0.05 the half-width of the interval is \sqrt{\log(40) / 2000} = 0.043 .

With probability at least 0.95, the true error lies in [0.077, 0.163].

Convexity

Definition 0.7 — Convex function and subgradient A function f : \mathbb{R}^d \to \mathbb{R} is convex when f(tx + (1 - t)y) \leq t f(x) + (1 - t) f(y) for all x, y and t \in [0, 1].

A vector g is a subgradient of f at x when f(y) \geq f(x) + \langle g, y - x \rangle \quad \text{for all } y . A convex function on \mathbb{R}^d has a subgradient at every point, and x minimizes f if and only if 0 is a subgradient at x.

Proposition 0.8 — Jensen’s inequality If f is convex and Z is integrable with f(Z) integrable, then f(\mathbb{E} Z) \leq \mathbb{E} f(Z) .

Proof. Let g be a subgradient at \mathbb{E}Z. Then f(Z) \geq f(\mathbb{E} Z) + \langle g, Z - \mathbb{E} Z \rangle , and taking expectations removes the last term. ∎

Two facts are used in ch. 6. An infimum of affine functions is concave. A convex function of one variable has non-decreasing one-sided derivatives.

Key takeaways — chapter 0

  • The regression function is the best predictor in mean square, and the excess squared risk of f is the squared L^2 distance between f and \eta.
  • Hoeffding’s inequality gives an exponential tail for bounded sums; a mean of n variables in [0, 1] deviates by about \sqrt{\log(1/\delta)/n}.
  • The union bound turns a bound for one predictor into a bound for N predictors at the price of \log N.
  • Convex functions have subgradients, and Jensen’s inequality follows from them.

1. The typology of learning problems and the Bayes predictors

Before any algorithm, a learning problem must be stated precisely: what is observed, what is predicted, and how errors are counted. This chapter sets the statistical framework and identifies, for each problem, the best predictor one could use if the distribution were known.

Definition 1.1 — Learning problem A learning problem consists of:

  • an input space \mathcal{X}, an output space \mathcal{Y} and a prediction space \mathcal{Y}' (often \mathcal{Y} itself, or \mathbb{R} for a score);
  • an unknown distribution P of a pair (X, Y) on \mathcal{X} \times \mathcal{Y};
  • a sample D_n = ((X_1, Y_1), \dots, (X_n, Y_n)) of independent copies of (X, Y);
  • a loss \ell(y', y) \geq 0, the cost of predicting y' when the truth is y.

A learning rule maps D_n to a predictor g_n : \mathcal{X} \to \mathcal{Y}'. The risk of a predictor g is R(g) = \mathbb{E}\, \ell(g(X), Y) .

The risk of the learned predictor, R(g_n), is a random variable: it depends on the sample.

A typology

Learning problems differ by the output space, by what is predicted and by the criterion.

Problem Output \mathcal{Y} Prediction Criterion Example
Binary classification \{-1, +1\} a label 0–1 loss, error probability spam filtering
Multiclass classification \{1, \dots, K\} a label 0–1 loss digit recognition
Regression \mathbb{R} a real number squared or absolute loss predicting a price
Scoring (bipartite ranking) \{-1, +1\} a real score; only its order matters ROC curve, AUC credit scoring, triage
Density estimation none a density log-likelihood modelling a population
Clustering none a partition distortion customer segmentation
Anomaly detection none a set of normal points mass and volume of the set fraud detection

The first four rows are supervised: the labels are observed. The last three are unsupervised. Between them, semi-supervised learning uses a few labels and many unlabelled points.

The sampling scheme also varies. In batch learning the whole sample is given at once, as above. In online learning the pairs arrive one by one and the predictor is updated after each; ch. 7 meets this setting through exponential weights. In active learning the learner chooses which labels to query, and in reinforcement learning its actions change the data it sees.

This course is about supervised batch learning, with classification as its main example.

The Bayes classifier

Definition 1.2 — Bayes classifier and Bayes risk In binary classification, \mathcal{Y} = \{-1, +1\} and the loss is \ell(y', y) = \mathbb{1}\{y' \neq y\}, so R(g) = \mathbb{P}(g(X) \neq Y). The regression function is now a probability: \eta(x) = \mathbb{P}(Y = +1 \mid X = x) .

The Bayes classifier predicts the more likely label: g^*(x) = +1 if \eta(x) > 1/2 and -1 otherwise. The Bayes risk is R^* = R(g^*).

Theorem 1.3 — Optimality of the Bayes classifier For every classifier g, R(g) - R^* = \mathbb{E}\Big[\, |2\eta(X) - 1|\; \mathbb{1}\{g(X) \neq g^*(X)\} \Big] \geq 0 , and the Bayes risk equals R^* = \mathbb{E}\big[\min(\eta(X), 1 - \eta(X))\big] .

Proof. Condition on X = x. The classifier errs when it predicts -1 and Y = +1, or when it predicts +1 and Y = -1: \mathbb{P}(g(X) \neq Y \mid X = x) = \eta(x)\, \mathbb{1}\{g(x) = -1\} + (1 - \eta(x))\, \mathbb{1}\{g(x) = +1\} .

If g(x) = g^*(x), the two conditional errors are equal. Otherwise g pays the larger of \eta(x) and 1 - \eta(x) while g^* pays the smaller; the difference is |2\eta(x) - 1|.

Integrating over x gives the first formula. The second is the conditional error of g^*, integrated. ∎

The theorem says more than optimality: a classifier loses little by disagreeing with g^* where \eta is close to 1/2. This remark produces the plug-in bound of ch. 2 and the fast rates of ch. 9.

Proposition 1.4 — Bayes predictors in regression For the squared loss, the best predictor is the regression function f^* = \eta of Definition 0.1, and by Proposition 0.2 the excess risk of f is R(f) - R(f^*) = \mathbb{E}\big[(f(X) - f^*(X))^2\big] . For the absolute loss |y' - y|, the best predictor is a conditional median of Y given X = x.

In every case the optimal predictor depends on the unknown P only through the conditional distribution of Y given X. Learning means approximating it from the sample.

Example 1.5 — Two Gaussian classes Let \mathbb{P}(Y = 1) = 1/2 and, given Y, let X \sim \mathcal{N}(Y \mu, \sigma^2 I_d). Bayes’ formula gives a logistic function of a linear form: \eta(x) = \frac{1}{1 + \exp(-2 \mu^\top x / \sigma^2)} .

The Bayes classifier is g^*(x) = \mathrm{sign}(\mu^\top x). Given Y = 1, the variable \mu^\top X is Gaussian with mean \|\mu\|^2 and standard deviation \sigma \|\mu\|, so R^* = \Phi(-\|\mu\| / \sigma) , with \Phi the standard Gaussian distribution function. For \|\mu\| = \sigma = 1, this gives R^* = 0.1587.

The simulation below checks both formulas of Theorem 1.3 on this model.

import numpy as np
from scipy.stats import norm

rng = np.random.default_rng(0)
n, sigma = 200_000, 1.0
mu = np.array([1.0, 0.0])                       # ||mu|| = 1
y = rng.choice([-1, 1], size=n)
X = y[:, None] * mu + sigma * rng.standard_normal((n, 2))

eta = 1 / (1 + np.exp(-2 * X @ mu / sigma**2))  # P(Y = +1 | X = x)
g_star = np.where(eta > 0.5, 1, -1)             # Bayes classifier
print("error of g* on the sample :", round(np.mean(g_star != y), 4))
print("Phi(-||mu||/sigma)        :", round(norm.cdf(-1.0), 4))
print("mean of min(eta, 1 - eta) :", round(np.mean(np.minimum(eta, 1 - eta)), 4))

The three printed values are 0.1599, 0.1587 and 0.1589. No classifier, however clever, can do better than 15.87 % on this problem.

Key takeaways — chapter 1

  • A learning problem is a distribution P, a loss and a sample; a learning rule maps the sample to a predictor whose risk is random.
  • Problems differ by their output and criterion: classification, regression and scoring are supervised; clustering, density estimation and anomaly detection are not.
  • The Bayes classifier thresholds \eta at 1/2, and the excess risk of any g is the mean of |2\eta - 1| over the region where g disagrees with it.
  • In regression the conditional mean (squared loss) or median (absolute loss) is optimal.

2. Performance criteria and inference principles

A learning rule is judged by its risk, but that risk is random and the distribution is unknown. This chapter defines what a good rule is, how its performance is measured on data, and the principles from which rules are built.

What a good rule is

Definition 2.1 — Excess risk and consistency The excess risk of a rule is R(g_n) - R^*. The rule is

  • consistent for P when \mathbb{E}\, R(g_n) \to R^* as n \to \infty;
  • strongly consistent for P when R(g_n) \to R^* almost surely;
  • universally consistent when it is consistent for every distribution P.

Since R(g_n) - R^* lies in [0, 1], consistency in expectation and in probability are equivalent.

Consistency is asymptotic. A non-asymptotic guarantee is a statement of the form: with probability at least 1 - \delta over the sample, R(g_n) - R^* \leq \varepsilon(n, \delta) . The function \varepsilon gives the rate; ch. 4–5 compute it for many rules.

Criteria beyond the error probability

The error probability treats both kinds of mistakes alike. In medicine or fraud detection they do not cost the same. Write \mathrm{FPR}(g) = \mathbb{P}(g(X) = 1 \mid Y = -1) for the false positive rate and \mathrm{TPR}(g) = \mathbb{P}(g(X) = 1 \mid Y = 1) for the true positive rate, also called recall or sensitivity.

For c \in (0, 1), the cost-sensitive risk charges c for a false positive and 1 - c for a false negative: R_c(g) = \mathbb{E}\big[\, c\, \mathbb{1}\{Y = -1,\, g(X) = 1\} + (1 - c)\, \mathbb{1}\{Y = 1,\, g(X) = -1\} \big] .

Proposition 2.2 — Cost-sensitive Bayes rule The classifier that minimizes R_c is g_c^*(x) = +1 \iff \eta(x) > c .

Proof. Given X = x, predicting +1 costs c\,(1 - \eta(x)) on average and predicting -1 costs (1 - c)\, \eta(x). The first is smaller exactly when \eta(x) > c. ∎

With p = \mathbb{P}(Y = 1) and c = p, the cost-sensitive risk is proportional to the balanced error (\mathrm{FPR} + 1 - \mathrm{TPR})/2. Changing c moves the threshold on \eta; the ROC curve of ch. 8 records all the thresholds at once.

Measuring performance on data

Proposition 2.3 — Test-set estimate Let g be fixed, or learned on data independent of a test sample of m fresh pairs, and let \hat R_m(g) be its error frequency on that sample. With probability at least 1 - \delta, |\hat R_m(g) - R(g)| \leq \sqrt{\frac{\log(2/\delta)}{2m}} .

Proof. The error indicators are independent, take values in [0, 1] and have mean R(g); apply Theorem 0.5 in both directions. ∎

The training error \hat R_n(g_n), computed on the sample used for learning, is optimistic: g_n was chosen to fit those points. Bounding that optimism is the purpose of ch. 4.

V-fold cross-validation splits the sample into V blocks, trains on V - 1 of them, tests on the last, and averages over the V choices. It estimates the risk of the rule trained on n(V-1)/V points; the folds are dependent, so Proposition 2.3 does not apply to it directly.

Inference principles

A rule has to turn the sample into a predictor. Four principles cover most algorithms.

Plug-in. Estimate \eta by some \hat\eta_n, then threshold: g_n(x) = +1 if \hat\eta_n(x) > 1/2.

Proposition 2.4 — Plug-in inequality For every function \hat\eta with values in [0, 1], the plug-in classifier \hat g satisfies R(\hat g) - R^* \leq 2\, \mathbb{E}\, |\hat\eta(X) - \eta(X)| \leq 2 \sqrt{\mathbb{E}\, (\hat\eta(X) - \eta(X))^2} .

Proof. Where \hat g(x) \neq g^*(x), the numbers \eta(x) and \hat\eta(x) lie on different sides of 1/2. Hence |2\eta(x) - 1| = 2\, |\eta(x) - 1/2| \leq 2\, |\eta(x) - \hat\eta(x)| .

Insert this in Theorem 1.3 and drop the indicator. The second inequality is Cauchy–Schwarz. ∎

A rate for estimating \eta in L^2 thus gives a rate for classification. The converse fails: classifying well only needs \hat\eta on the right side of 1/2.

Empirical risk minimization (ERM). Fix a class \mathcal{G} of classifiers and choose \hat g_n \in \arg\min_{g \in \mathcal{G}} \hat R_n(g), \qquad \hat R_n(g) = \frac{1}{n} \sum_{i=1}^n \mathbb{1}\{g(X_i) \neq Y_i\} .

Proposition 2.5 — Estimation and approximation The excess risk of ERM splits into two terms, R(\hat g_n) - R^* = \underbrace{R(\hat g_n) - \inf_{\mathcal{G}} R}_{\text{estimation}} + \underbrace{\inf_{\mathcal{G}} R - R^*}_{\text{approximation}} , and the estimation term is controlled by a uniform deviation: R(\hat g_n) - \inf_{g \in \mathcal{G}} R(g) \leq 2 \sup_{g \in \mathcal{G}} |\hat R_n(g) - R(g)| .

Proof. For any g \in \mathcal{G}, write R(\hat g_n) - R(g) as the sum of three differences:

  • R(\hat g_n) - \hat R_n(\hat g_n), at most the supremum;
  • \hat R_n(\hat g_n) - \hat R_n(g), non-positive by definition of \hat g_n;
  • \hat R_n(g) - R(g), at most the supremum.

Take the infimum over g. ∎

A richer class lowers the approximation error and raises the estimation error. This trade-off is the central tension of the course.

Penalization. Let the data choose the richness of the class.

Definition 2.6 — Penalized ERM and regularization Given nested classes \mathcal{G}_1 \subset \mathcal{G}_2 \subset \cdots with ERMs \hat g_k and penalties \mathrm{pen}_n(k), structural risk minimization returns \hat g_{\hat k}, where \hat k \in \arg\min_k \big( \hat R_n(\hat g_k) + \mathrm{pen}_n(k) \big) . Regularization is the continuous version: minimize \hat R_n(f) + \lambda\, \Omega(f) for a complexity measure \Omega, such as a norm. Proposition 5.8 gives a penalty that works.

Maximum likelihood. If one posits a model \{p_\theta(y \mid x)\} for the conditional law of Y, the conditional maximum-likelihood estimator maximizes \sum_i \log p_\theta(Y_i \mid X_i).

Example 2.7 — Maximum likelihood is ERM with a surrogate loss In the logistic model, \eta_\theta(x) = 1/(1 + e^{-\theta^\top x}). For y \in \{-1, +1\} this reads p_\theta(y \mid x) = \frac{1}{1 + e^{-y\, \theta^\top x}} .

The negative log-likelihood is therefore \sum_{i=1}^n \log\big(1 + e^{-Y_i\, \theta^\top X_i}\big), an empirical risk with the logistic loss of the margin Y_i\, \theta^\top X_i. When the model is wrong, the estimator still minimizes this risk; ch. 6 says what that buys for classification.

Local averaging is a fifth, nonparametric route: it estimates \eta(x) by averaging the labels of the sample points near x, then plugs in. It is the subject of the second half of ch. 3.

Key takeaways — chapter 2

  • A rule is consistent when its risk tends to the Bayes risk, universally consistent when this holds for every distribution; rates quantify how fast.
  • Unequal costs move the Bayes threshold on \eta from 1/2 to c.
  • A test error on m fresh points is accurate to \sqrt{\log(2/\delta)/(2m)}; the training error is optimistic.
  • Plug-in, ERM, penalization and maximum likelihood are the inference principles; the excess risk of ERM is an estimation error plus an approximation error.

3. Statistical models and main algorithms

The classical classification algorithms each implement one of the principles of ch. 2. This chapter presents them by family, with one main theorem per family: a closed form for discriminant analysis, a mistake bound for the perceptron, and universal consistency for nearest neighbours.

Discriminant analysis

Proposition 3.1 — Linear discriminant analysis Suppose that, given Y = y, the input is Gaussian \mathcal{N}(\mu_y, \Sigma) with a common covariance \Sigma \succ 0, and let \pi_y = \mathbb{P}(Y = y). Then the log-odds are affine: \log \frac{\eta(x)}{1 - \eta(x)} = w^\top x + b, \qquad w = \Sigma^{-1}(\mu_{+} - \mu_{-}), and with the intercept b = \tfrac12\, \mu_{-}^\top \Sigma^{-1} \mu_{-} - \tfrac12\, \mu_{+}^\top \Sigma^{-1} \mu_{+} + \log(\pi_{+} / \pi_{-}) .

Proof. By Bayes’ formula the log-odds equal \log(\pi_+ / \pi_-) plus the log-ratio of the two Gaussian densities. The normalizing constants are equal and the quadratic terms x^\top \Sigma^{-1} x cancel, leaving an affine function of x. ∎

LDA plugs in the class frequencies, the class means and the pooled empirical covariance. With different covariances, the quadratic terms remain and the boundary becomes a quadric (QDA). Example 1.5 is the case \mu_\pm = \pm \mu and \Sigma = \sigma^2 I, where w = 2\mu / \sigma^2 and b = 0.

Linear discriminative models

Definition 3.2 — Logistic regression Logistic regression models \eta_\theta(x) = \sigma(\theta^\top x), with \sigma(t) = 1/(1 + e^{-t}), and estimates \theta by maximum likelihood (Example 2.7): \hat\theta \in \arg\min_\theta\; \frac1n \sum_{i=1}^n \log\big(1 + e^{-Y_i\, \theta^\top X_i}\big) . The objective is convex: its Hessian \frac1n \sum_{i=1}^n \sigma'(Y_i\, \theta^\top X_i)\; X_i X_i^\top is a non-negative combination of rank-one PSD matrices.

Newton’s method (iteratively reweighted least squares) or a gradient method solves it. On linearly separable data the infimum is not attained, since the loss decreases along any separating direction; a penalty \lambda \|\theta\|^2 restores a minimizer.

The perceptron (Rosenblatt, 1958) is the oldest learning algorithm. It starts from w_0 = 0 and runs through the examples; whenever Y_i \langle w, X_i \rangle \leq 0, it updates w \leftarrow w + Y_i X_i.

Theorem 3.3 — Perceptron mistake bound (Novikoff, 1962) Assume \|X_i\| \leq \rho and that some unit vector w^* separates the data with margin \gamma > 0: Y_i \langle w^*, X_i \rangle \geq \gamma for all i. Then on any ordering of the examples, the perceptron makes at most k \leq (\rho / \gamma)^2 updates.

Proof. Let w_k be the vector after k updates.

  • Each update adds Y_i \langle X_i, w^* \rangle \geq \gamma to \langle w, w^* \rangle, so \langle w_k, w^* \rangle \geq k\gamma.
  • An update happens only when Y_i \langle w_{k-1}, X_i \rangle \leq 0, so \|w_k\|^2 \leq \|w_{k-1}\|^2 + \|X_i\|^2, and \|w_k\|^2 \leq k \rho^2.
  • By Cauchy–Schwarz, k\gamma \leq \langle w_k, w^* \rangle \leq \|w_k\| \leq \rho \sqrt{k} .

Squaring the last chain gives the bound. ∎

The bound does not involve the dimension: the margin, not the number of parameters, measures the difficulty. Margins return in ch. 6 and in the analysis of boosting in ch. 7.

Local averaging

Definition 3.4 — Local averaging rules A local averaging estimate of \eta has the form \eta_n(x) = \sum_{i=1}^n W_{n,i}(x)\, \mathbb{1}\{Y_i = 1\}, with weights W_{n,i}(x) \geq 0 that sum to 1 and depend only on x, X_1, \dots, X_n. The rule classifies by plug-in. Three choices of weights:

  • k nearest neighbours: W_{n,i}(x) = 1/k if X_i is among the k nearest neighbours of x, and 0 otherwise;
  • kernel rule: W_{n,i}(x) \propto K((x - X_i)/h) for a kernel K \geq 0 and a bandwidth h;
  • partition rule: W_{n,i}(x) = 1/N(x) if X_i falls in the cell of x, which holds N(x) sample points.

Theorem 3.5 — Stone’s theorem for nearest neighbours (Stone, 1977) In \mathbb{R}^d with the Euclidean distance and ties broken at random, if k_n \to \infty \quad \text{and} \quad k_n / n \to 0 , then the k_n-nearest-neighbour rule is universally consistent: \mathbb{E}\, R(g_n) \to R^* for every distribution of (X, Y).

Proof. Sketch with the key steps. By Proposition 2.4 it suffices to show \mathbb{E}|\eta_n(X) - \eta(X)| \to 0. Introduce the average of the true \eta over the k neighbours of x: \tilde\eta_n(x) = \frac1k \sum_{i \in \mathrm{NN}_k(x)} \eta(X_i) .

  • Variance. Given X_1, \dots, X_n, the differences \mathbb{1}\{Y_i = 1\} - \eta(X_i) are independent, centred and of variance at most 1/4. Hence \mathbb{E}\, |\eta_n(x) - \tilde\eta_n(x)| \leq \frac{1}{2\sqrt{k}} \longrightarrow 0 .
  • Bias. If \eta is continuous with compact support, \tilde\eta_n(X) - \eta(X) \to 0, because the distance from X to its k-th neighbour tends to 0 when k/n \to 0.
  • General \eta. Approximate \eta in L^1(P_X) by such a function. Stone’s lemma controls the transfer: a point is among the k nearest neighbours of at most k \gamma_d sample points, where the constant \gamma_d depends only on the dimension.

Devroye, Györfi and Lugosi (1996) give the complete proof. ∎

The choice k = \sqrt{n} meets both conditions; k = 1 does not. The next result says what happens to the 1-NN rule.

Proposition 3.6 — Asymptotic risk of the 1-NN rule (Cover and Hart, 1967) If \eta is continuous, the risk of the 1-NN rule tends to R_{\mathrm{NN}} = \mathbb{E}[2\eta(X)(1 - \eta(X))], and R^* \leq R_{\mathrm{NN}} \leq 2 R^* (1 - R^*) .

Proof. Limit (sketch). The nearest neighbour of X converges to X, so its label behaves like an independent draw with probability \eta(X) of being +1. The rule errs when the two labels differ, with probability 2\eta(X)(1 - \eta(X)).

Inequalities. Let m = \min(\eta, 1 - \eta), so that 2\eta(1 - \eta) = 2m(1 - m) and R^* = \mathbb{E}\, m.

  • Since 1 - m \geq 1/2, 2m(1 - m) \geq m; take expectations.
  • By Jensen, \mathbb{E}\, m^2 \geq (R^*)^2, so \mathbb{E}[2m(1 - m)] \leq 2R^* - 2(R^*)^2. ∎

Partitions and trees

Definition 3.7 — Classification trees (CART) A classification tree partitions \mathcal{X} by recursive binary splits \{x_j \leq t\}; each leaf predicts its majority label. At each node, CART chooses the split that most decreases the Gini impurity 2p(1 - p), where p is the proportion of positive labels in the node.

The tree is grown deep, then pruned by minimizing \hat R_n(T) + \alpha\, |T| over subtrees, with |T| the number of leaves: a penalized ERM in the sense of Definition 2.6.

Trees are readable and handle mixed features, but small changes of the sample change the splits: they have high variance. The ensembles of ch. 7 exploit exactly this.

Two more families complete the picture. Support vector machines minimize a regularized hinge loss over linear functions or a reproducing kernel Hilbert space; ch. 6 analyses them, and Kernel Methods develops them. Neural networks x \mapsto \sum_j a_j\, \sigma(w_j^\top x + b_j) are trained with the same surrogate losses; Deep Learning and Theoretical Foundations of Deep Learning study them.

Algorithm Principle (ch. 2) Main result
LDA, QDA plug-in with a Gaussian model Proposition 3.1
Logistic regression maximum likelihood = ERM with the logistic loss Theorem 6.4 in ch. 6
Perceptron online ERM on separable data Theorem 3.3
k-NN, kernel and partition rules plug-in with local averaging Theorem 3.5, Proposition 3.6
CART penalized ERM over partitions Definition 3.7, ch. 7

Example 3.8 — Nearest neighbours on the Gaussian model The code compares k = 1 and k = \sqrt{n} on the model of Example 1.5.

import numpy as np
from sklearn.neighbors import KNeighborsClassifier

rng = np.random.default_rng(1)
mu = np.array([1.0, 0.0])
def sample(n):
    y = rng.choice([-1, 1], size=n)
    return y[:, None] * mu + rng.standard_normal((n, 2)), y

Xte, yte = sample(20_000)
eta = 1 / (1 + np.exp(-2 * Xte @ mu))
print("Bayes risk  ~", round(np.mean(np.minimum(eta, 1 - eta)), 4))
print("Cover-Hart  ~", round(np.mean(2 * eta * (1 - eta)), 4))
for n in [100, 1_000, 10_000]:
    X, y = sample(n)
    for k in [1, int(np.sqrt(n))]:
        err = 1 - KNeighborsClassifier(n_neighbors=k).fit(X, y).score(Xte, yte)
        print(f"n = {n:6d}   k = {k:3d}   test error = {err:.4f}")

The 1-NN error stays at 0.219–0.227, around the Cover–Hart limit 0.225. With k = \sqrt{n} the error falls from 0.191 to 0.162, then to 0.159: Stone’s theorem at work.

Key takeaways — chapter 3

  • Gaussian classes with a common covariance have affine log-odds; LDA plugs in estimates, and logistic regression fits the same form by maximum likelihood.
  • The perceptron makes at most (\rho/\gamma)^2 mistakes on separable data: the margin, not the dimension, sets the difficulty.
  • Local averaging rules are universally consistent when the neighbourhoods shrink while containing more and more points (k \to \infty, k/n \to 0).
  • The 1-NN rule is not consistent, but its asymptotic risk is at most twice the Bayes risk.
  • Trees are penalized ERMs over partitions, readable but unstable.

4. Empirical risk minimization and complexity measures

By Proposition 2.5, the estimation error of ERM is at most twice the uniform deviation \sup_{\mathcal{G}} |\hat R_n - R|. This chapter bounds that supremum: first for finite classes, then through two complexity measures, the VC dimension and the Rademacher complexity.

Finite classes

Proposition 4.1 — Finite classes Let \mathcal{G} contain N classifiers. With probability at least 1 - \delta, \sup_{g \in \mathcal{G}} |\hat R_n(g) - R(g)| \leq \sqrt{\frac{\log(2N/\delta)}{2n}} , and therefore the ERM satisfies R(\hat g_n) - \inf_{\mathcal{G}} R \leq \sqrt{\frac{2 \log(2N/\delta)}{n}} .

Proof. Apply Proposition 2.3 to each g at level \delta/N, then the union bound; conclude with Proposition 2.5. ∎

For N = 10^6 rules, n = 10\,000 examples and \delta = 0.05, the uniform deviation is at most \sqrt{17.50 / 20\,000} = 0.030. A million candidates cost only a logarithm.

Proposition 4.2 — Finite classes, realizable case If some g \in \mathcal{G} has R(g) = 0, then with probability at least 1 - \delta, every g \in \mathcal{G} with \hat R_n(g) = 0 satisfies R(g) \leq \frac{\log(N/\delta)}{n} .

Proof. A fixed g with R(g) > \varepsilon makes no training error with probability (1 - \varepsilon)^n \leq e^{-n\varepsilon}. A union bound over at most N such classifiers, and N e^{-n\varepsilon} = \delta, conclude. ∎

Without noise the rate is 1/n instead of 1/\sqrt{n}: in the example above, 0.0017 instead of 0.03. Chapter 9 explains the intermediate regimes.

Growth function and VC dimension

Most useful classes are infinite, but on n points they produce finitely many labellings.

Definition 4.3 — Growth function and VC dimension For points x_1, \dots, x_n, the trace of \mathcal{G} is the set of label vectors (g(x_1), \dots, g(x_n)), g \in \mathcal{G}. The growth function is the largest trace size over n points: S_{\mathcal{G}}(n) = \max_{x_1, \dots, x_n} \big|\{(g(x_1), \dots, g(x_n)) : g \in \mathcal{G}\}\big| \leq 2^n .

The class shatters x_1, \dots, x_n when its trace has 2^n elements. The VC dimension V is the largest n such that S_{\mathcal{G}}(n) = 2^n, and V = \infty if there is none.

Example 4.4 — Thresholds and intervals on the line

  • Thresholds x \mapsto \mathrm{sign}(x - t): on sorted points, the traces are (-, \dots, -, +, \dots, +), so S(n) = n + 1 and V = 1.
  • Intervals (label +1 inside [a, b]): the positive points form a block of consecutive points, so S(n) = n(n+1)/2 + 1. Two points are shattered; three are not, since (+, -, +) is impossible. Hence V = 2.

Proposition 4.5 — Half-spaces The class of affine classifiers x \mapsto \mathrm{sign}(w^\top x + b) on \mathbb{R}^d has VC dimension d + 1.

Proof. Lower bound. The points 0, e_1, \dots, e_d are shattered: for labels y_0, \dots, y_d, take b = y_0/2 and w_j = y_j - y_0/2.

Upper bound. Take d + 2 points. They are affinely dependent: \sum_i \lambda_i x_i = 0 and \sum_i \lambda_i = 0 for some \lambda \neq 0.

Let I = \{i : \lambda_i > 0\} and \Lambda = \sum_{i \in I} \lambda_i > 0. The point z = \sum_{i \in I} \frac{\lambda_i}{\Lambda} x_i = \sum_{i \notin I} \frac{-\lambda_i}{\Lambda} x_i lies in both convex hulls (Radon’s theorem).

Label the points of I positive and the others negative. A half-space containing the first group contains z, while its complement contains the second group and z: a contradiction. ∎

Lemma 4.6 — Sauer–Shelah lemma If \mathcal{G} has VC dimension V < \infty, then for every n, S_{\mathcal{G}}(n) \leq \sum_{i=0}^{V} \binom{n}{i} \leq \Big(\frac{e n}{V}\Big)^V \quad (n \geq V) .

Proof. Write \Phi(n, V) for the binomial sum. Let H \subset \{-1, +1\}^n be a set of label vectors whose VC dimension is at most V; we show |H| \leq \Phi(n, V) by induction on n.

If V = 0, no coordinate takes two values, so |H| \leq 1. Otherwise:

  • Let H' be the projection of H on the first n - 1 coordinates, and let H'' collect the projected vectors whose two extensions both belong to H. Counting the vectors of H through their projections gives |H| = |H'| + |H''| .
  • The VC dimension of H' is at most V. That of H'' is at most V - 1: if it shatters a set T, the original set of vectors shatters T \cup \{n\}.
  • By induction and Pascal’s rule, |H| \leq \Phi(n-1, V) + \Phi(n-1, V-1) = \Phi(n, V) .

For the second bound, when n \geq V, \Big(\frac{V}{n}\Big)^V \Phi(n, V) \leq \sum_{i=0}^{V} \binom{n}{i} \Big(\frac{V}{n}\Big)^i \leq \Big(1 + \frac{V}{n}\Big)^n \leq e^V . ∎

The growth function is thus either 2^n for all n or bounded by a polynomial of degree V: there is nothing in between.

Theorem 4.7 — Vapnik–Chervonenkis inequality (1971) For every class \mathcal{G} of binary classifiers, every n and every \varepsilon > 0, \mathbb{P}\Big(\sup_{g \in \mathcal{G}} |\hat R_n(g) - R(g)| > \varepsilon\Big) \leq 8\, S_{\mathcal{G}}(n)\, e^{-n \varepsilon^2 / 32} .

Proof. Sketch. Three steps reduce the supremum to a finite union bound.

  1. Ghost sample. Replace R(g) by the error \hat R'_n(g) on an independent copy of the sample, at the price of a factor 2 in probability.
  2. Random signs. Exchanging (X_i, Y_i) and its copy does not change the joint law, so the difference \hat R_n - \hat R'_n can be multiplied termwise by independent random signs.
  3. Conditioning. Given the points, the class produces at most S_{\mathcal{G}}(n) distinct error vectors on each sample; apply Hoeffding’s inequality to the signs and a union bound.

Devroye, Györfi and Lugosi (1996) give the full proof with these constants. ∎

The error vectors (\mathbb{1}\{g(X_i) \neq Y_i\})_i are in one-to-one correspondence with the traces of \mathcal{G}, which is why S_{\mathcal{G}} appears. With Lemma 4.6 the deviation is of order \sqrt{V \log n / n}, for every distribution.

Rademacher complexity

The VC dimension ignores the distribution and handles only binary functions. Linear functions with a bounded norm in high dimension have a large VC dimension, yet margins suggest that they are easy to learn. A data-dependent measure handles both issues.

Definition 4.8 — Rademacher complexity Let \mathcal{F} be a class of real functions on a set \mathcal{Z}, and let \sigma_1, \dots, \sigma_n be independent signs, uniform on \{-1, +1\}. The empirical Rademacher complexity on points z_1, \dots, z_n is \hat{\mathfrak{R}}_n(\mathcal{F}) = \mathbb{E}_\sigma \Big[\sup_{f \in \mathcal{F}} \frac{1}{n} \sum_{i=1}^n \sigma_i f(z_i)\Big] . The Rademacher complexity \mathfrak{R}_n(\mathcal{F}) is its expectation when z_i = Z_i are independent draws.

It measures how well the class can correlate with pure noise. A class that fits every sign pattern has complexity close to its range; a single function has complexity 0.

Theorem 4.9 — Bounded differences inequality (McDiarmid, 1989) Let Z_1, \dots, Z_n be independent and let \Phi change by at most c_i when its i-th argument changes. Then \mathbb{P}\big(\Phi(Z_1, \dots, Z_n) - \mathbb{E}\,\Phi \geq t\big) \leq \exp\Big(-\frac{2t^2}{\sum_i c_i^2}\Big) . Proof sketch: write \Phi - \mathbb{E}\Phi as a sum of martingale differences D_k = \mathbb{E}[\Phi \mid Z_1, \dots, Z_k] - \mathbb{E}[\Phi \mid Z_1, \dots, Z_{k-1}] . Given the past, D_k lies in an interval of length c_k. Hoeffding’s lemma applies conditionally, and the proof of Theorem 0.5 goes through.

Theorem 4.10 — Rademacher generalization bound Let \mathcal{F} take values in [0, 1]. With probability at least 1 - \delta, every f \in \mathcal{F} satisfies \mathbb{E} f(Z) \leq \frac1n \sum_{i=1}^n f(Z_i) + 2\, \mathfrak{R}_n(\mathcal{F}) + \sqrt{\frac{\log(1/\delta)}{2n}} . With probability at least 1 - \delta, the same holds with 2 \hat{\mathfrak{R}}_n(\mathcal{F}) and 3\sqrt{\log(2/\delta)/(2n)}.

Proof. Consider the largest gap over the class, \Phi = \sup_{f \in \mathcal{F}} \Big(\mathbb{E} f - \frac1n \sum_{i=1}^n f(Z_i)\Big) .

  • Concentration. Changing one Z_i changes \Phi by at most 1/n. Theorem 4.9 gives, with probability at least 1 - \delta, \Phi \leq \mathbb{E}\Phi + \sqrt{\log(1/\delta)/(2n)}.
  • Symmetrization. Let Z'_1, \dots, Z'_n be an independent copy, so that \mathbb{E} f = \mathbb{E}' \frac1n \sum_i f(Z'_i). Moving the supremum inside the expectation, \mathbb{E}\, \Phi \leq \mathbb{E} \sup_f \frac1n \sum_{i=1}^n \big(f(Z'_i) - f(Z_i)\big) .
  • Signs. Swapping Z_i and Z'_i leaves the law unchanged, so each difference can be multiplied by \sigma_i. Splitting the supremum, the right-hand side is at most 2\, \mathfrak{R}_n(\mathcal{F}).

For the empirical version, \hat{\mathfrak{R}}_n also has differences at most 1/n; apply Theorem 4.9 to it and to \Phi at level \delta/2 each. ∎

Key result — uniform deviation through Rademacher complexity \sup_{f \in \mathcal{F}} \Big(\mathbb{E} f - \frac1n \sum_{i=1}^n f(Z_i)\Big) \leq 2\, \mathfrak{R}_n(\mathcal{F}) + \sqrt{\frac{\log(1/\delta)}{2n}} \quad \text{with probability} \geq 1 - \delta .

Lemma 4.11 — Massart’s finite class lemma Let A \subset \mathbb{R}^n be finite and r = \max_{a \in A} \|a\|_2. Then \mathbb{E}_\sigma \Big[\max_{a \in A} \frac1n \sum_{i=1}^n \sigma_i a_i\Big] \leq \frac{r \sqrt{2 \log |A|}}{n} .

Proof. For \lambda > 0, Jensen’s inequality and Hoeffding’s lemma (with \sigma_i a_i \in [-|a_i|, |a_i|]) give e^{\lambda\, \mathbb{E} \max_a \sum_i \sigma_i a_i} \leq \sum_{a \in A} \prod_{i=1}^n \mathbb{E}\, e^{\lambda \sigma_i a_i} \leq |A|\, e^{\lambda^2 r^2 / 2} . Hence the expected maximum is at most \log|A| / \lambda + \lambda r^2 / 2. The choice \lambda = \sqrt{2 \log|A|} / r gives the bound; divide by n. ∎

Corollary 4.12 — ERM over a VC class For the 0–1 loss, a class of VC dimension V and n \geq V, the loss class has \mathfrak{R}_n \leq \sqrt{2V \log(en/V)/n}. With probability at least 1 - \delta, the ERM satisfies R(\hat g_n) - \inf_{\mathcal{G}} R \leq 2\sqrt{\frac{2V \log(en/V)}{n}} + \sqrt{\frac{2\log(2/\delta)}{n}} .

Proof. On the sample, the error vectors are at most S_{\mathcal{G}}(n) binary vectors of norm at most \sqrt{n}. Lemma 4.11 and Lemma 4.6 bound the complexity.

For the ERM, let g^\circ attain \inf_{\mathcal{G}} R (or approach it).

  • Theorem 4.10 at level \delta/2 bounds R(\hat g_n) - \hat R_n(\hat g_n).
  • By definition, \hat R_n(\hat g_n) \leq \hat R_n(g^\circ).
  • Hoeffding’s inequality (Theorem 0.5, one-sided) at level \delta/2 bounds \hat R_n(g^\circ) - R(g^\circ) by \sqrt{\log(2/\delta)/(2n)}.

Adding the three bounds gives the result. ∎

For half-planes in \mathbb{R}^2 (V = 3), \delta = 0.05 and n = 10\,000, the bound is 0.175; at n = 100\,000 it is 0.061. The constants are pessimistic, but the shape \sqrt{V/n} is right: ch. 5 shows it cannot be improved beyond the logarithm.

Proposition 4.13 — Linear functions with bounded norm In a Hilbert space, let \mathcal{F}_B be the class of linear functions x \mapsto \langle w, x \rangle with \|w\| \leq B. Then \hat{\mathfrak{R}}_n(\mathcal{F}_B) \leq \frac{B}{n} \sqrt{\sum_{i=1}^n \|x_i\|^2} \leq \frac{B \rho}{\sqrt{n}} \quad \text{if } \|x_i\| \leq \rho .

Proof. By Cauchy–Schwarz, with equality for the best w, the supremum equals \sup_{\|w\| \leq B} \frac1n \Big\langle w, \sum_i \sigma_i x_i \Big\rangle = \frac{B}{n} \Big\|\sum_i \sigma_i x_i\Big\| . By Jensen, the expectation of \|\sum_i \sigma_i x_i\| is at most the square root of \mathbb{E}\|\sum_i \sigma_i x_i\|^2. In that second moment the cross terms vanish, leaving \sum_i \|x_i\|^2. ∎

The dimension does not appear, only the norms. Chapter 6 combines this with surrogate losses.

Example 4.14 — Rademacher complexities by Monte Carlo The code estimates \hat{\mathfrak{R}}_n for linear functions on the unit sphere of \mathbb{R}^5 and for thresholds on the line, with n = 200.

import numpy as np

rng = np.random.default_rng(2)
n, d, B, reps = 200, 5, 1.0, 2000
X = rng.standard_normal((n, d))
X /= np.linalg.norm(X, axis=1, keepdims=True)    # ||x_i|| = 1
sig = rng.choice([-1, 1], size=(reps, n))         # Rademacher signs

# linear class {x -> <w, x> : ||w|| <= B}: the sup equals (B/n) ||sum_i sigma_i x_i||
lin = B * np.linalg.norm(sig @ X, axis=1).mean() / n
print(f"linear     : {lin:.4f}   bound B/sqrt(n) = {B / np.sqrt(n):.4f}")

# thresholds x -> 1{x > t}: on sorted points, the n + 1 patterns 0...0 1...1
patterns = np.tril(np.ones((n + 1, n)), k=-1)[:, ::-1]
thr = (sig @ patterns.T).max(axis=1).mean() / n
print(f"thresholds : {thr:.4f}   Massart sqrt(2 log(n+1)/n) = {np.sqrt(2 * np.log(n + 1) / n):.4f}")

The linear class gives 0.067 against the bound 0.071: Proposition 4.13 is nearly tight. For thresholds the estimate is 0.055, while Massart’s lemma gives 0.230. The n + 1 patterns are strongly correlated, and the union bound inside Lemma 4.11 ignores it; chaining arguments remove the logarithm.

Key takeaways — chapter 4

  • For N classifiers, the uniform deviation is \sqrt{\log(N/\delta)/n}; without noise, ERM reaches \log(N/\delta)/n.
  • The growth function of a class of VC dimension V is at most (en/V)^V; half-spaces in \mathbb{R}^d have V = d + 1.
  • The VC inequality and the Rademacher bound make ERM consistent on every class of finite VC dimension, at rate \sqrt{V \log n / n}.
  • Rademacher complexity is data-dependent and dimension-free for linear functions with bounded norm: B\rho/\sqrt{n}.

5. Main theorems: learnability, lower bounds and consistency

Chapter 4 showed that a finite VC dimension is enough for ERM to learn. This chapter shows that it is also necessary, that the rate \sqrt{V/n} cannot be improved, that no rule learns every distribution at a fixed rate, and how growing classes yield universally consistent rules.

Definition 5.1 — PAC learnability (Valiant, 1984; Haussler, 1992) A class \mathcal{G} is agnostic PAC learnable if there are a rule and a function n_{\mathcal{G}}(\varepsilon, \delta) such that, for every distribution P and all \varepsilon, \delta \in (0, 1), a sample of size n \geq n_{\mathcal{G}}(\varepsilon, \delta) gives \mathbb{P}\Big(R(g_n) - \inf_{\mathcal{G}} R \leq \varepsilon\Big) \geq 1 - \delta . The smallest such function is the sample complexity. The realizable version asks this only for distributions with \inf_{\mathcal{G}} R = 0.

No free lunch

Theorem 5.2 — No-free-lunch theorem Let A be any learning rule for binary classification on a domain \mathcal{X}, and let the sample size satisfy n < |\mathcal{X}|/2. Then some distribution admits a classifier of zero risk, and yet, with probability at least 1/7 over the sample, R(A(D_n)) \geq 1/8 .

Proof. Take a subset C of 2n points and draw the input uniformly from it. Each of the 2^{2n} labellings f_j of these points defines a noiseless distribution P_j, in which the label is f_j(X).

  • For a fixed sample of inputs, at least n points of C are unseen. Pair the f_j that differ only at one unseen point v: the rule gives the same prediction at v for both, so it errs at v for exactly one of them.
  • Each unseen point has mass 1/(2n), and there are at least n of them. Averaging over the labellings, the expected risk is at least \frac12 \cdot \frac12 = \frac14. Hence some P_j gives an expected risk of at least 1/4.
  • Since the risk is at most 1, with q = \mathbb{P}(R \geq 1/8) we get 1/4 \leq q + (1 - q)/8, so q \geq 1/7. ∎

No rule learns every problem from a sample that has not seen most of the domain: prior knowledge, encoded by a class or by assumptions on P, is unavoidable.

Corollary 5.3 — Infinite VC dimension is not learnable A class with infinite VC dimension is not PAC learnable, not even in the realizable case. Proof: for every n, apply Theorem 5.2 to a shattered set C of 2n points; every labelling of C is realized by the class, so \inf_{\mathcal{G}} R = 0 while the rule fails with probability at least 1/7.

The fundamental theorem

Theorem 5.4 — Fundamental theorem of statistical learning For a class \mathcal{G} of binary classifiers and the 0–1 loss, the following are equivalent:

  1. uniform convergence: \sup_{\mathcal{G}} |\hat R_n - R| \to 0 in probability, uniformly over all distributions;
  2. ERM is an agnostic PAC learner for \mathcal{G};
  3. \mathcal{G} is agnostic PAC learnable;
  4. \mathcal{G} has finite VC dimension V.

When V < \infty, there are universal constants C_1, C_2 such that the sample complexity satisfies C_1\, \frac{V + \log(1/\delta)}{\varepsilon^2} \leq n_{\mathcal{G}}(\varepsilon, \delta) \leq C_2\, \frac{V + \log(1/\delta)}{\varepsilon^2} , and in the realizable case it satisfies C_1\, \frac{V + \log(1/\delta)}{\varepsilon} \leq n_{\mathcal{G}}(\varepsilon, \delta) \leq C_2\, \frac{V \log(1/\varepsilon) + \log(1/\delta)}{\varepsilon} .

Proof. The cycle of implications uses results already proved:

  • 4 ⇒ 1 is the VC inequality (Theorem 4.7) or Corollary 4.12;
  • 1 ⇒ 2 is Proposition 2.5;
  • 2 ⇒ 3 holds by definition;
  • 3 ⇒ 4 is Corollary 5.3, since agnostic learnability includes the realizable distributions.

The upper bound without the \log n factor of Corollary 4.12 needs a chaining argument, and the lower bounds are Theorem 5.5. Shalev-Shwartz and Ben-David (2014, ch. 6 and 28) give the complete proofs. ∎

Lower bounds

Theorem 5.5 — Minimax lower bounds Let \mathcal{G} have VC dimension V \geq 2. There are universal constants c, c' > 0 such that, for every rule and every n \geq V:

  • realizable case (Ehrenfeucht, Haussler, Kearns and Valiant, 1989): some P with \inf_{\mathcal{G}} R = 0 gives \mathbb{E}\, R(g_n) \geq c\, (V - 1)/n;
  • agnostic case: some P gives \mathbb{E}\, R(g_n) - \inf_{\mathcal{G}} R \geq c' \sqrt{V / n} .

Idea of the proof: on V shattered points, each carrying a label that is only slightly biased, \eta = \frac12 \pm \varepsilon, telling the bias apart needs about 1/\varepsilon^2 observations per point. With \varepsilon \approx \sqrt{V/n} every rule guesses many of the biases wrong. Devroye, Györfi and Lugosi (1996) give the precise constants; Exercise 16 treats one point.

So ERM over a VC class is optimal up to a logarithm. The lower bounds hold over all distributions in a fixed class; without a class, the situation is worse.

Theorem 5.6 — No universal rate (Devroye, 1982) Let (a_n) be positive numbers decreasing to 0, with a_1 \leq 1/16. For every sequence of classification rules there is a distribution of (X, Y) with R^* = 0 such that \mathbb{E}\, R(g_n) \geq a_n \quad \text{for all } n .

Stone’s theorem gives consistency for every distribution; Theorem 5.6 says that no rate can hold for every distribution. Rates require assumptions: the Bayes classifier in a VC class, smoothness of \eta, or the margin conditions of ch. 9.

Consistency with growing classes

Theorem 5.7 — Consistency of ERM over growing classes Let \mathcal{G}_1 \subset \mathcal{G}_2 \subset \cdots have finite VC dimensions V_k, and suppose that \inf_{\mathcal{G}_k} R \to R^* for every distribution. If k_n \to \infty \quad \text{and} \quad \frac{V_{k_n} \log n}{n} \to 0 , then ERM over \mathcal{G}_{k_n} is universally consistent.

Proof. By Proposition 2.5, the excess risk is at most the approximation error \inf_{\mathcal{G}_{k_n}} R - R^*, which tends to 0, plus twice the expected uniform deviation.

The symmetrization of Theorem 4.10, applied in both directions with Lemma 4.11 on at most 2 S_{\mathcal{G}}(n) vectors, gives \mathbb{E} \sup_{\mathcal{G}_{k_n}} |\hat R_n - R| \leq 2 \sqrt{\frac{2 \log(2 S_{\mathcal{G}_{k_n}}(n))}{n}} , which tends to 0 by Lemma 4.6 and the assumption. ∎

Histograms on a grid whose mesh shrinks, linear combinations of a growing number of stumps, and networks with a growing number of units all fit this scheme. The theorem requires knowing how fast to grow the class; penalization lets the data decide.

Proposition 5.8 — An oracle inequality for structural risk minimization Let S_k be the growth function of \mathcal{G}_k, and define the penalty \mathrm{pen}_n(k) = 2 \sqrt{\frac{2 \log(2 S_k(n))}{n}} + \sqrt{\frac{\log(k(k+1)/\delta)}{2n}} . With probability at least 1 - \delta, the penalized ERM of Definition 2.6 satisfies R(\hat g_{\hat k}) - R^* \leq \min_k \Big\{ \inf_{\mathcal{G}_k} R - R^* + 2\, \mathrm{pen}_n(k) \Big\} .

Proof. The uniform deviation over \mathcal{G}_k has bounded differences 1/n. By Theorem 4.9 and the bound in the proof of Theorem 5.7, it is at most \mathrm{pen}_n(k) except on an event of probability \delta / (k(k+1)).

These probabilities sum to \delta, so with probability at least 1 - \delta the bound holds for all k at once. Then, for every k and every g \in \mathcal{G}_k:

  • the risk of the selected classifier is at most its empirical risk plus \mathrm{pen}_n(\hat k);
  • by the choice of \hat k, this is at most \hat R_n(\hat g_k) + \mathrm{pen}_n(k);
  • since \hat g_k minimizes the empirical risk on \mathcal{G}_k, this is at most \hat R_n(g) + \mathrm{pen}_n(k) \leq R(g) + 2\, \mathrm{pen}_n(k) . ∎

The rule does as well as if an oracle had told it the best class, up to the penalty. Making the penalty data-dependent, for instance with \hat{\mathfrak{R}}_n, is the idea of Rademacher penalization (Koltchinskii, 2001).

Key takeaways — chapter 5

  • No rule learns every problem (no free lunch); a class of infinite VC dimension is not learnable.
  • Finite VC dimension, uniform convergence, learnability and the success of ERM are equivalent; the sample complexity is of order (V + \log(1/\delta))/\varepsilon^2.
  • The rate \sqrt{V/n} is minimax optimal up to a logarithm, and V/n in the realizable case.
  • Universal consistency is possible, universal rates are not.
  • ERM over growing classes is universally consistent, and structural risk minimization picks the class nearly as well as an oracle.

6. Convex risk minimization

ERM with the 0–1 loss is computationally hard: even approximating, within some constant factor, the largest number of sample points that a half-space classifies correctly is NP-hard (Ben-David, Eiron and Long, 2003). Most practical classifiers instead minimize a convex surrogate of the margin y f(x). This chapter asks when this still leads to the Bayes classifier, and how fast.

Definition 6.1 — Margin losses and surrogate risk A real-valued function f classifies by its sign, and y f(x) is its margin on the pair (x, y). For a loss \varphi : \mathbb{R} \to [0, \infty), the \varphi-risk is R_\varphi(f) = \mathbb{E}\, \varphi(Y f(X)), \qquad R_\varphi^* = \inf_f R_\varphi(f) , the infimum running over all measurable functions.

Loss \varphi(u) Used by
0–1 \mathbb{1}\{u \leq 0\} ERM of ch. 4
hinge \max(0, 1 - u) support vector machines
logistic \log(1 + e^{-u}) logistic regression (Example 2.7)
exponential e^{-u} AdaBoost (ch. 7)
square (1 - u)^2 least-squares classification

Calibration

Conditioning on X = x reduces the question to a single number \alpha = f(x).

Definition 6.2 — Conditional risk and calibration For \eta \in [0, 1] and \alpha \in \mathbb{R}, let C_\eta(\alpha) = \eta\, \varphi(\alpha) + (1 - \eta)\, \varphi(-\alpha), \qquad H(\eta) = \inf_{\alpha} C_\eta(\alpha) , and let H^-(\eta) be the infimum of C_\eta(\alpha) over the wrong sign, \alpha (2\eta - 1) \leq 0. The loss is classification-calibrated when H^-(\eta) > H(\eta) for every \eta \neq 1/2.

Then R_\varphi(f) = \mathbb{E}\, C_{\eta(X)}(f(X)) and R_\varphi^* = \mathbb{E}\, H(\eta(X)).

Calibration means that the pointwise minimizer of the surrogate always has the sign of the Bayes classifier.

Theorem 6.3 — Calibration of convex losses (Bartlett, Jordan and McAuliffe, 2006) A convex loss \varphi is classification-calibrated if and only if it is differentiable at 0 with \varphi'(0) < 0.

Proof. If. C_\eta is convex and differentiable at 0, with derivative (2\eta - 1)\, \varphi'(0) there. Take \eta > 1/2; the derivative is negative.

  • Moving from 0 to small \alpha > 0 decreases C_\eta, so H(\eta) < C_\eta(0) = \varphi(0).
  • For \alpha \leq 0, the tangent at 0 lies below the convex function C_\eta, and \alpha times a negative number is non-negative: C_\eta(\alpha) \geq C_\eta(0) + \alpha\, (2\eta - 1)\, \varphi'(0) \geq C_\eta(0) . Hence H^-(\eta) = \varphi(0).

Hence H^-(\eta) > H(\eta); the case \eta < 1/2 is symmetric. The converse is proved in the paper. ∎

The hinge, logistic, exponential and square losses have \varphi'(0) = -1, -\frac12, -1, -2: all are calibrated. The perceptron loss \max(0, -u) is not (Exercise 11).

Comparison inequalities

Theorem 6.4 — Comparison inequality (Zhang, 2004; Bartlett, Jordan and McAuliffe, 2006) Let \varphi be convex and calibrated, and define the \psi-transform on [0, 1] by \psi(\theta) = \varphi(0) - H\Big(\frac{1 + \theta}{2}\Big) . Then \psi is convex with \psi(0) = 0, and for every measurable f,

Key result — excess risk controlled by excess surrogate risk \psi\big(R(\mathrm{sign}\, f) - R^*\big) \leq R_\varphi(f) - R_\varphi^* .

Proof. Properties of \psi. The function H is an infimum of affine functions of \eta, hence concave, so \psi is convex. It is symmetric: H(\eta) = H(1 - \eta).

By convexity of \varphi, the average \frac12(\varphi(\alpha) + \varphi(-\alpha)) is at least \varphi(0). Its infimum H(1/2) is therefore \varphi(0), and \psi(0) = 0.

The inequality. Let \theta(x) = 2\eta(x) - 1 and let A be the set where \mathrm{sign}\, f disagrees with g^*.

  • Theorem 1.3 and Jensen’s inequality give \psi\big(R(\mathrm{sign}\, f) - R^*\big) = \psi\big(\mathbb{E}[\,|\theta|\, \mathbb{1}_A]\big) \leq \mathbb{E}\big[\psi(|\theta|)\, \mathbb{1}_A\big] .
  • On A, f(x)\, \theta(x) \leq 0, so C_{\eta(x)}(f(x)) \geq H^-(\eta(x)) = \varphi(0), as in the proof of Theorem 6.3. Since \psi(|\theta(x)|) = \varphi(0) - H(\eta(x)), this gives \psi(|\theta(x)|) \leq C_{\eta(x)}(f(x)) - H(\eta(x)) .
  • Off A, the right-hand side is still non-negative. Taking expectations gives R_\varphi(f) - R_\varphi^*. ∎

Example 6.5 — Four \psi-transforms Minimizing C_\eta in closed form gives H, then \psi.

  • Hinge: H(\eta) = 1 - |2\eta - 1| and \psi(\theta) = \theta. The minimizer is \mathrm{sign}(2\eta - 1).
  • Square: H(\eta) = 4\eta(1 - \eta) and \psi(\theta) = \theta^2. The minimizer is 2\eta - 1.
  • Exponential: H(\eta) = 2\sqrt{\eta(1 - \eta)} and \psi(\theta) = 1 - \sqrt{1 - \theta^2} \geq \theta^2/2. The minimizer is \frac12 \log \frac{\eta}{1 - \eta}.
  • Logistic: H is the binary entropy (in nats), and \psi(\theta) is the Kullback–Leibler divergence between Bernoulli laws of means (1+\theta)/2 and 1/2. By Pinsker’s inequality, \psi(\theta) \geq \theta^2 / 2. The minimizer is \log \frac{\eta}{1 - \eta}.

An excess hinge risk of 0.02 guarantees an excess classification risk of at most 0.02. An excess logistic or exponential risk of 0.02 only guarantees \sqrt{2 \times 0.02} = 0.2 .

The minimizers tell another story. The logistic minimizer recovers \eta through the sigmoid, so logistic regression estimates probabilities; the hinge minimizer keeps only the sign, so SVM outputs are not probabilities.

Estimation error

Lemma 6.6 — Contraction (Ledoux and Talagrand, 1991) If \varphi is L-Lipschitz, then for every class \mathcal{F} of real functions and all points, \hat{\mathfrak{R}}_n(\varphi \circ \mathcal{F}) \leq L\, \hat{\mathfrak{R}}_n(\mathcal{F}) . The proof replaces one coordinate at a time; Mohri, Rostamizadeh and Talwalkar (2012) give it in this form.

Theorem 6.7 — Estimation error of surrogate minimization over linear functions Let \|X\| \leq \rho and let \mathcal{F}_B be the linear functions of norm at most B. Assume that, on the range [-B\rho, B\rho] of the margins, the loss is L-Lipschitz and bounded by M.

If \hat f minimizes the empirical \varphi-risk over \mathcal{F}_B, then with probability at least 1 - \delta, R_\varphi(\hat f) - \inf_{\mathcal{F}_B} R_\varphi \leq \frac{2 L B \rho}{\sqrt{n}} + M \sqrt{\frac{2 \log(2/\delta)}{n}} .

Proof. Apply the argument of Corollary 4.12 to the class (x, y) \mapsto \varphi(y \langle w, x \rangle), with Theorem 4.10 rescaled to [0, M]. The signs y_i can be absorbed into the \sigma_i. Lemma 6.6 and Proposition 4.13 then bound its Rademacher complexity by L B \rho / \sqrt{n}. ∎

Combining Theorems 6.4 and 6.7, the excess classification risk is at most \psi^{-1} of the estimation error plus the approximation error \inf_{\mathcal{F}_B} R_\varphi - R_\varphi^*. Over a rich class — a reproducing kernel Hilbert space with a universal kernel, or combinations of base classifiers — with a radius B_n growing slowly, both terms vanish. This is how the consistency of SVMs (Steinwart, 2005) and of regularized boosting (Lugosi and Vayatis, 2004) is proved.

Minimizing the empirical \varphi-risk is a convex problem; Convex Optimization covers the algorithms.

Example 6.8 — Three surrogates on a Gaussian problem With \mu = (1, 0.5) in the model of Example 1.5, the Bayes risk is \Phi(-1.118) = 0.1318. The code trains three linear classifiers on 500 points.

import numpy as np
from scipy.stats import norm
from sklearn.linear_model import LogisticRegression
from sklearn.svm import LinearSVC

rng = np.random.default_rng(3)
mu = np.array([1.0, 0.5])                    # Bayes risk = Phi(-||mu||)
def sample(n):
    y = rng.choice([-1, 1], size=n)
    return y[:, None] * mu + rng.standard_normal((n, 2)), y
X, y = sample(500)
Xte, yte = sample(50_000)

Z = np.c_[X, np.ones(len(X))] * y[:, None]   # rows y_i (x_i, 1)
w = np.zeros(3)
for _ in range(2000):                        # gradient descent on mean exp(-y f(x))
    w += 0.1 * (Z * np.exp(-Z @ w)[:, None]).mean(axis=0)
f_exp = np.c_[Xte, np.ones(len(Xte))] @ w

print(f"Bayes risk   {norm.cdf(-np.linalg.norm(mu)):.4f}")
print(f"logistic     {1 - LogisticRegression(C=1e4).fit(X, y).score(Xte, yte):.4f}")
svm = LinearSVC(C=1.0, loss='hinge', random_state=0)   # the default loss is the squared hinge
print(f"hinge (SVM)  {1 - svm.fit(X, y).score(Xte, yte):.4f}")
print(f"exponential  {np.mean(np.sign(f_exp) != yte):.4f}")

The test errors are 0.1345, 0.1362 and 0.1347: all three surrogates land within 0.005 of the Bayes risk. Here the Bayes classifier is linear, so the approximation error vanishes and calibration does the rest.

Key takeaways — chapter 6

  • Convex surrogates replace an NP-hard problem by a convex one; a convex loss is calibrated exactly when \varphi'(0) < 0.
  • The \psi-transform converts excess surrogate risk into excess classification risk: linearly for the hinge loss, through a square root for the logistic, exponential and square losses.
  • Contraction and the bound B\rho/\sqrt{n} give dimension-free estimation errors for regularized linear classifiers.
  • Estimation error, approximation error and the comparison inequality together prove the consistency of SVMs and boosting.

7. Aggregation and ensemble methods

Instead of choosing one predictor, one can combine many. Averaging independent-looking predictors reduces variance (bagging, random forests); reweighting the data reduces bias (boosting); exponential weights combine a finite family almost as well as its best member.

Bagging and random forests

Bagging (Breiman, 1996) draws B bootstrap samples, each made of n draws with replacement from D_n, trains the same base rule on each, and averages the outputs (regression) or takes a majority vote (classification).

Proposition 7.1 — Averaging correlated predictors Let f_1(x), \dots, f_B(x) be identically distributed, with variance s^2 and pairwise correlation \rho \geq 0. Then \mathrm{Var}\Big(\frac1B \sum_{b=1}^B f_b(x)\Big) = \rho\, s^2 + \frac{1 - \rho}{B}\, s^2 .

Proof. The variance of the sum is B s^2 + B(B - 1)\rho s^2; divide by B^2. ∎

Averaging leaves the bias unchanged and removes only the uncorrelated part of the variance: as B \to \infty, the term \rho s^2 remains. Decorrelating the base predictors is therefore the point.

The same holds for votes. If 25 classifiers erred independently with probability 0.3, Hoeffding’s inequality would bound the error of the majority by e^{-2 \cdot 25 \cdot 0.2^2} = 0.135, and the exact binomial tail is 0.017. Independence never holds exactly, and Proposition 7.1 measures what correlation costs.

Definition 7.2 — Random forest (Breiman, 2001) A random forest bags deep classification trees, and at each split chooses the best cut among a random subset of m_{\mathrm{try}} of the d features (often \sqrt{d}). The extra randomness lowers the correlation \rho between trees.

Each point is absent from a bootstrap sample with probability (1 - 1/n)^n \approx e^{-1} = 0.368. Predicting it with the trees that did not see it gives the out-of-bag estimate of the test error, at no extra cost.

from sklearn.datasets import make_classification
from sklearn.ensemble import BaggingClassifier, RandomForestClassifier
from sklearn.tree import DecisionTreeClassifier

X, y = make_classification(n_samples=1000, n_features=10, n_informative=5,
                           flip_y=0.05, random_state=0)
Xtr, ytr, Xte, yte = X[:500], y[:500], X[500:], y[500:]
models = {
    "one deep tree": DecisionTreeClassifier(random_state=0),
    "bagging, 200 trees": BaggingClassifier(DecisionTreeClassifier(), n_estimators=200,
                                            oob_score=True, random_state=0),
    "random forest, 200 trees": RandomForestClassifier(n_estimators=200, oob_score=True,
                                                       random_state=0),
}
for name, m in models.items():
    m.fit(Xtr, ytr)
    oob = f"   out-of-bag {1 - m.oob_score_:.3f}" if hasattr(m, "oob_score_") else ""
    print(f"{name:25s} test error {1 - m.score(Xte, yte):.3f}{oob}")

One tree has a test error of 0.120, bagging 0.084 and the forest 0.068; the out-of-bag estimates (0.070 and 0.064) are close to the test errors.

Boosting

Definition 7.3 — AdaBoost (Freund and Schapire, 1997) Let \mathcal{H} be a class of base classifiers with values in \{-1, +1\}. Start from the weights w_1(i) = 1/n. For t = 1, \dots, T:

  1. choose h_t \in \mathcal{H} whose weighted error is below one half: \varepsilon_t = \sum_{i=1}^n w_t(i)\, \mathbb{1}\{h_t(X_i) \neq Y_i\} < \frac12 ;
  2. set \alpha_t = \frac12 \log \frac{1 - \varepsilon_t}{\varepsilon_t} ;
  3. reweight w_{t+1}(i) = w_t(i)\, e^{-\alpha_t Y_i h_t(X_i)} / Z_t, where Z_t normalizes the weights.

The output is the sign of F_T = \sum_t \alpha_t h_t.

Misclassified points gain weight, so each new base classifier concentrates on the examples its predecessors got wrong.

Theorem 7.4 — Training error of AdaBoost Write \varepsilon_t = \frac12 - \gamma_t. The training error of the output satisfies \hat R_n(\mathrm{sign}\, F_T) \leq \prod_{t=1}^T 2\sqrt{\varepsilon_t (1 - \varepsilon_t)} = \prod_{t=1}^T \sqrt{1 - 4\gamma_t^2} \leq \exp\Big(-2 \sum_{t=1}^T \gamma_t^2\Big) .

Proof.

  • Since \mathbb{1}\{u \leq 0\} \leq e^{-u}, the training error is at most the empirical exponential risk of F_T.
  • Unrolling the updates, w_{T+1}(i) = e^{-Y_i F_T(X_i)} / (n \prod_t Z_t). These weights sum to 1, so the empirical exponential risk equals \prod_t Z_t.
  • With the chosen \alpha_t, Z_t = (1 - \varepsilon_t)\, e^{-\alpha_t} + \varepsilon_t\, e^{\alpha_t} = 2\sqrt{\varepsilon_t(1 - \varepsilon_t)} .
  • Finally 1 - 4\gamma^2 \leq e^{-4\gamma^2}. ∎

If every base classifier beats chance by \gamma > 0, the training error is at most e^{-2\gamma^2 T}, hence 0 after T > \log(n)/(2\gamma^2) rounds.

Proposition 7.5 — AdaBoost minimizes the exponential risk greedily (Friedman, Hastie and Tibshirani, 2000) Round t of AdaBoost minimizes the empirical exponential risk of F_{t-1} + \alpha h, first over h \in \mathcal{H}, then exactly over \alpha.

Proof. Let \varepsilon be the weighted error of h under w_t. Up to the constant factor \prod_{s < t} Z_s, the risk equals (1 - \varepsilon)\, e^{-\alpha} + \varepsilon\, e^{\alpha} . For \alpha > 0 it increases with \varepsilon, so the best h minimizes the weighted error. The derivative in \alpha vanishes at \alpha_t. ∎

AdaBoost is thus coordinate descent on the exponential surrogate of ch. 6, over linear combinations of base classifiers. Gradient boosting (Friedman, 2001) replaces the exponential loss by any differentiable loss.

The code below runs AdaBoost with decision stumps x \mapsto s\, \mathrm{sign}(x_j - t), written from scratch.

import numpy as np
from sklearn.datasets import make_classification

X, y = make_classification(n_samples=1000, n_features=10, n_informative=5,
                           flip_y=0.05, random_state=0)
y = 2 * y - 1
Xtr, ytr, Xte, yte = X[:500], y[:500], X[500:], y[500:]

def stump(X, y, w):
    """Best rule s * sign(x_j - t) for the weights w (summing to 1)."""
    Wneg, best = w[y == -1].sum(), (np.inf,)
    for j in range(X.shape[1]):
        o = np.argsort(X[:, j])
        err = Wneg + np.r_[0, np.cumsum((w * y)[o])]   # error of "+1 iff x_j > t"
        for s, e in ((1, err), (-1, 1 - err)):
            k = np.argmin(e)
            if e[k] < best[0]:
                best = (e[k], j, X[o[k - 1], j] if k > 0 else -np.inf, s)
    return best

w, Ftr, Fte, bound = np.full(500, 1 / 500), np.zeros(500), np.zeros(500), 1.0
for t in range(1, 201):
    eps, j, thr, s = stump(Xtr, ytr, w)
    alpha = 0.5 * np.log((1 - eps) / eps)
    h_tr, h_te = s * np.where(Xtr[:, j] > thr, 1, -1), s * np.where(Xte[:, j] > thr, 1, -1)
    Ftr, Fte = Ftr + alpha * h_tr, Fte + alpha * h_te
    w = w * np.exp(-alpha * ytr * h_tr); w /= w.sum()
    bound *= 2 * np.sqrt(eps * (1 - eps))
    if t in (1, 10, 50, 200):
        print(f"T = {t:3d}  train {np.mean(np.sign(Ftr) != ytr):.3f}  "
              f"bound {bound:.3f}  test {np.mean(np.sign(Fte) != yte):.3f}")

After 1, 10, 50 and 200 rounds the training error is 0.128, 0.086, 0.054 and 0.010, below the bound of Theorem 7.4 (0.668, 0.429, 0.266, 0.108). The test error falls from 0.124 to 0.096 at 50 rounds and stays near 0.10 afterwards.

Margins

Boosting often keeps improving its test error after the training error has reached 0 (Schapire, Freund, Bartlett and Lee, 1998). The explanation is the margin: normalized by \sum_t \alpha_t, the output F_T lies in the convex hull of \mathcal{H}, and further rounds increase the margins Y_i F_T(X_i).

Proposition 7.6 — Rademacher complexity of a convex hull For every class \mathcal{H} and all points, \hat{\mathfrak{R}}_n(\mathrm{conv}\, \mathcal{H}) = \hat{\mathfrak{R}}_n(\mathcal{H}) .

Proof. For fixed signs, f \mapsto \sum_i \sigma_i f(x_i) is linear, and the supremum of a linear function over a convex hull is reached at the generating points. ∎

Theorem 7.7 — Margin bound (Schapire, Freund, Bartlett and Lee, 1998; Koltchinskii and Panchenko, 2002) Let \gamma \in (0, 1]. With probability at least 1 - \delta, every f \in \mathrm{conv}\, \mathcal{H} satisfies \mathbb{P}(Y f(X) \leq 0) \leq \frac1n \sum_{i=1}^n \mathbb{1}\{Y_i f(X_i) \leq \gamma\} + \frac{2}{\gamma}\, \mathfrak{R}_n(\mathcal{H}) + \sqrt{\frac{\log(1/\delta)}{2n}} .

Proof. The ramp loss r_\gamma(u) = \min(1, \max(0, 1 - u/\gamma)) lies between \mathbb{1}\{u \leq 0\} and \mathbb{1}\{u \leq \gamma\}, and it is (1/\gamma)-Lipschitz.

Apply Theorem 4.10 to the class (x, y) \mapsto r_\gamma(y f(x)), then Lemma 6.6 and Proposition 7.6; the labels are absorbed into the random signs. ∎

The number of rounds does not appear: only the margin distribution and the complexity of the base class do. Lugosi and Vayatis (2004) combine such bounds with the comparison inequality of ch. 6 to prove that regularized boosting is Bayes-risk consistent.

Exponential weights

Take M fixed predictors f_j (trained on a separate sample, or given as experts), and a loss in [0, 1] that is convex in the prediction. Pairs arrive one at a time, and L_{t-1,j} denotes the cumulative loss of f_j before round t. The exponentially weighted average predicts p_t = \sum_{j=1}^M w_{t,j}\, f_j(x_t), \qquad w_{t,j} \propto e^{-\eta L_{t-1, j}} .

Theorem 7.8 — Regret of exponential weights For every sequence of data, with no probabilistic assumption and \eta = \sqrt{8 \log M / T}, the cumulative loss of the aggregate exceeds that of the best predictor by at most \sum_{t=1}^T \ell(p_t, y_t) - \min_{j} L_{T, j} \leq \sqrt{\frac{T \log M}{2}} .

Proof. Let W_t = \sum_j e^{-\eta L_{t-1, j}}, so that W_1 = M and \log W_{T+1} \geq -\eta \min_j L_{T,j}.

  • Each ratio W_{t+1}/W_t is the mean of e^{-\eta \ell_{t,J}} when J is drawn from the weights w_t.
  • By Hoeffding’s lemma, this is at most \exp(-\eta\, \mathbb{E}\, \ell_{t,J} + \eta^2/8), and by convexity \mathbb{E}\, \ell_{t,J} \geq \ell(p_t, y_t).
  • Summing the logarithms over t, -\eta \min_j L_{T,j} - \log M \leq -\eta \sum_{t=1}^T \ell(p_t, y_t) + \frac{T\eta^2}{8} .

The regret is thus at most \log M / \eta + T\eta / 8, and the chosen \eta balances the two terms. ∎

On independent data, averaging the successive aggregates turns this into a batch guarantee of order \sqrt{\log M / n} (Cesa-Bianchi, Conconi and Gentile, 2004); for exp-concave losses, mirror averaging reaches \log M / n (Juditsky, Rigollet and Tsybakov, 2008). Stacking (Wolpert, 1992) learns the weights by cross-validation instead. Sequential Learning develops the online side.

Key takeaways — chapter 7

  • Averaging B predictors divides only the uncorrelated part of their variance; random forests decorrelate trees by randomizing the splits, and the out-of-bag error is a free test error.
  • AdaBoost is greedy minimization of the exponential risk; its training error decays like e^{-2\gamma^2 T} under weak learning.
  • Margin bounds explain why boosting keeps generalizing: the convex hull of a class is no more complex than the class.
  • Exponential weights have regret \sqrt{(T/2)\log M} against the best of M predictors, on any sequence.

8. Scoring and bipartite ranking

In credit scoring, medical triage or document retrieval, one must order individuals by their chance of being positive rather than label them. The criterion becomes a curve, and the optimal rules are the increasing transforms of \eta.

Definition 8.1 — Scoring function, ROC curve, AUC A scoring function is a measurable s : \mathcal{X} \to \mathbb{R}. For a threshold t, the rule “positive if s(x) > t” has false and true positive rates \mathrm{FPR}_s(t) = \mathbb{P}(s(X) > t \mid Y = -1), \qquad \mathrm{TPR}_s(t) = \mathbb{P}(s(X) > t \mid Y = 1) . The ROC curve is the graph of t \mapsto (\mathrm{FPR}_s(t), \mathrm{TPR}_s(t)), written \alpha \mapsto \mathrm{ROC}_s(\alpha). With (X', Y') an independent copy of (X, Y), the AUC is \mathrm{AUC}(s) = \mathbb{P}\big(s(X) > s(X') \mid Y = 1, Y' = -1\big) + \tfrac12\, \mathbb{P}\big(s(X) = s(X') \mid Y = 1, Y' = -1\big) .

A random score has AUC 1/2; a score that puts every positive above every negative has AUC 1.

Proposition 8.2 — The AUC is the area under the ROC curve If s(X) has a continuous distribution given Y = -1, then \mathrm{AUC}(s) = \int_0^1 \mathrm{ROC}_s(\alpha)\, d\alpha .

Proof. Let T' be the score of an independent negative example. By the probability integral transform, \mathrm{FPR}_s(T') is uniform on [0, 1]. By definition of the curve, \mathrm{ROC}_s(\mathrm{FPR}_s(t)) = \mathrm{TPR}_s(t) . Hence the integral equals \mathbb{E}[\mathrm{TPR}_s(T')], the probability that a positive example scores above T'. ∎

Theorem 8.3 — Optimal scoring functions Assume that \eta(X) has a continuous distribution. For every scoring function s and every \alpha \in (0, 1), \mathrm{ROC}_s(\alpha) \leq \mathrm{ROC}_\eta(\alpha), \qquad \text{hence} \qquad \mathrm{AUC}(s) \leq \mathrm{AUC}(\eta) . Every strictly increasing transform of \eta has the same, optimal, ROC curve.

Proof. This is the Neyman–Pearson lemma. Let P_\pm be the laws of X given Y = \pm 1 and p = \mathbb{P}(Y = 1). The likelihood ratio \frac{dP_+}{dP_-}(x) = \frac{1 - p}{p} \cdot \frac{\eta(x)}{1 - \eta(x)} is an increasing function of \eta(x).

Fix \alpha, and choose thresholds so that the sets A^* = \{\eta > t^*\} and A = \{s > t\} both have mass \alpha under the negative distribution. Let k be the value of the likelihood ratio on the boundary of A^*.

  • Pointwise, (\mathbb{1}_{A^*} - \mathbb{1}_A)(dP_+/dP_- - k) \geq 0, since both factors have the same sign.
  • Integrating against P_- gives P_+(A^*) - P_+(A) \geq k\, (P_-(A^*) - P_-(A)) = 0. ∎

Scoring thus asks for the order induced by \eta: less than estimating \eta, more than classifying at a single threshold.

Proposition 8.4 — AUC as a classification risk on pairs Let p = \mathbb{P}(Y = 1) and assume no ties. The ranking risk, the probability that a random pair is misordered, is L(s) = \mathbb{P}\big((s(X) - s(X'))(Y - Y') < 0\big) = 2p(1 - p)\, \big(1 - \mathrm{AUC}(s)\big) .

Proof. A pair can be misordered only if its labels differ. The events \{Y = 1, Y' = -1\} and \{Y = -1, Y' = 1\} each have probability p(1 - p). Given either one, the pair is misordered with probability 1 - \mathrm{AUC}(s), by symmetry. ∎

Maximizing the AUC is therefore a classification problem on pairs, for the pairwise rule \mathrm{sign}(s(x) - s(x')).

Empirical AUC maximization

Definition 8.5 — Empirical AUC and ranking risk With n_+ positive and n_- negative examples, the empirical AUC is the Mann–Whitney statistic divided by n_+ n_-: \widehat{\mathrm{AUC}}_n(s) = \frac{1}{n_+ n_-} \sum_{i : Y_i = 1} \sum_{j : Y_j = -1} \mathbb{1}\{s(X_i) > s(X_j)\} . The empirical ranking risk averages the misordering indicator over all ordered pairs: L_n(s) = \frac{1}{n(n-1)} \sum_{i \neq j} \mathbb{1}\big\{(s(X_i) - s(X_j))(Y_i - Y_j) < 0\big\} . It is a U-statistic of order 2: an average over pairs, not a sum of independent terms.

Theorem 8.6 — Uniform deviation of the empirical ranking risk Let \mathcal{S} be a class of scoring functions whose pairwise rules have VC dimension V and growth function S, and let m = \lfloor n/2 \rfloor. With probability at least 1 - \delta, \sup_{s \in \mathcal{S}} |L_n(s) - L(s)| \leq 2 \sqrt{\frac{2 \log(2 S(m))}{m}} + \sqrt{\frac{2 \log(1/\delta)}{n}} .

Proof. Expectation. By Hoeffding’s representation, L_n(s) is the average, over all permutations \pi of the sample, of W_\pi(s) = \frac1m \sum_{i=1}^m \mathbb{1}\big\{(s(X_{\pi(i)}) - s(X_{\pi(m+i)}))(Y_{\pi(i)} - Y_{\pi(m+i)}) < 0\big\} , an average of m independent pairs. The supremum of an average is at most the average of the suprema, and all W_\pi have the same law. The bound of Theorem 5.7 for m independent terms then applies.

Concentration. Changing one observation changes 2(n - 1) of the n(n-1) ordered pairs, hence L_n by at most 2/n. Theorem 4.9 concludes. ∎

The empirical ranking risk minimizer therefore has excess ranking risk of order \sqrt{V \log n / n}, as in classification. This argument is the one of Clémençon, Lugosi and Vayatis (2008), who also obtain faster rates under low-noise conditions by Hoeffding’s decomposition of U-statistics.

Pairwise surrogates. As in ch. 6, the indicator of a misordered pair is replaced by a convex loss of the score difference. RankBoost (Freund, Iyer, Schapire and Singer, 2003) minimizes, over linear combinations F of base scores, the pairwise exponential risk \frac{1}{n_+ n_-} \sum_{i : Y_i = 1} \sum_{j : Y_j = -1} \exp\big(-(F(X_i) - F(X_j))\big) . It runs the rounds of Definition 7.3 with the weights placed on the n_+ n_- positive–negative pairs instead of the points. Ranking SVMs use the hinge loss on the same pairs.

Univariate surrogates. The minimizer \log(\eta/(1 - \eta)) of the logistic risk (Example 6.5) is strictly increasing in \eta, so by Theorem 8.3 it is an optimal score. The hinge minimizer \mathrm{sign}(2\eta - 1) collapses the order and is not.

TreeRank (Clémençon and Vayatis, 2009) builds a piecewise-linear approximation of the optimal ROC curve by recursive partitioning. Each cell C is one segment of the curve, of horizontal length \alpha(C) = P_-(C) and vertical length \beta(C) = P_+(C). Splitting C into a part C' ranked first and the rest adds a vertex, and the AUC gains the area of a triangle: \tfrac12 \big( \alpha(C)\, \beta(C') - \beta(C)\, \alpha(C') \big) . Maximizing the empirical version of this gain over C' \subset C is a cost-sensitive classification problem inside C (Proposition 2.2).

Example 8.7 — AUC of the Gaussian model In Example 1.5 with \sigma = 1, the optimal score is s(x) = \mu^\top x. The difference of the scores of a positive and a negative example is Gaussian with mean 2\|\mu\|^2 and variance 2\|\mu\|^2, so \mathrm{AUC}^* = \Phi\big(\sqrt{2}\, \|\mu\|\big) = 0.9214 \quad \text{for } \|\mu\| = 1 .

import numpy as np
from scipy.stats import norm, rankdata
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score

rng = np.random.default_rng(4)
mu = np.array([1.0, 0.0])
def sample(n):
    y = rng.choice([-1, 1], size=n)
    return y[:, None] * mu + rng.standard_normal((n, 2)), y

def auc(s, y):
    """Empirical AUC through the Mann-Whitney rank formula (mid-ranks for ties)."""
    r, n1, n0 = rankdata(s), (y == 1).sum(), (y == -1).sum()
    return (r[y == 1].sum() - n1 * (n1 + 1) / 2) / (n1 * n0)

X, y = sample(300)
Xte, yte = sample(20_000)
s_lr = LogisticRegression().fit(X, y).decision_function(Xte)
print("theory Phi(sqrt 2)   :", round(norm.cdf(np.sqrt(2)), 4))
print("oracle score mu'x    :", round(auc(Xte @ mu, yte), 4))
print("logistic regression  :", round(auc(s_lr, yte), 4), round(roc_auc_score(yte, s_lr), 4))
print("useless coordinate   :", round(auc(Xte[:, 1], yte), 4))

The oracle score reaches 0.9218 and logistic regression trained on 300 points 0.9217, with the rank formula and scikit-learn agreeing; the useless coordinate gives 0.503, the AUC of chance.

Key takeaways — chapter 8

  • A scoring function is judged by its ROC curve; the AUC is the area under it and the probability that a positive is scored above a negative.
  • By the Neyman–Pearson lemma, \eta and its increasing transforms have the best ROC curve at every level.
  • One minus the AUC is, up to the factor 2p(1-p), a classification risk on pairs; its empirical version is a U-statistic.
  • Hoeffding’s representation gives uniform deviations of order \sqrt{V \log n / n} for empirical AUC maximization.
  • The logistic loss yields an optimal score at the population level; the hinge loss does not.

9. Complements for self-study

This chapter extends the in-class material in three directions: rates faster than 1/\sqrt{n} when the labels are not too noisy (a complement to ch. 4–5), the selection of a rule on held-out data (ch. 2), and algorithmic stability, a route to generalization that avoids complexity measures (ch. 4 and 6).

Margin conditions and fast rates

The \sqrt{V/n} lower bound of Theorem 5.5 is built from distributions with \eta close to 1/2 on a large set. Excluding them gives faster rates.

Definition 9.1 — Margin condition (Mammen and Tsybakov, 1999; Tsybakov, 2004) The distribution satisfies the margin condition with exponent \alpha \geq 0 and constant C > 0 when \mathbb{P}\big(|2\eta(X) - 1| \leq t\big) \leq C\, t^\alpha \qquad \text{for all } t > 0 . Massart’s condition is the extreme case |2\eta(X) - 1| \geq h > 0 almost surely.

Proposition 9.2 — Disagreement is controlled by excess risk Under the margin condition, every classifier g satisfies \mathbb{P}(g(X) \neq g^*(X)) \leq 2\, C^{1/(1+\alpha)}\, \big(R(g) - R^*\big)^{\alpha/(1+\alpha)} . Under Massart’s condition, \mathbb{P}(g(X) \neq g^*(X)) \leq (R(g) - R^*)/h.

Proof. Let A = \{g \neq g^*\}, \theta = 2\eta - 1 and \Delta = R(g) - R^*. For every t > 0, split A according to |\theta| \leq t or not, and use Theorem 1.3 on the second part: \mathbb{P}(A) \leq C t^\alpha + \frac{\mathbb{E}[\,|\theta|\, \mathbb{1}_A]}{t} = C t^\alpha + \frac{\Delta}{t} . The choice t = (\Delta / C)^{1/(1+\alpha)} makes the two terms equal and gives the bound. Under Massart’s condition, \Delta \geq h\, \mathbb{P}(A) directly. ∎

The difference of losses \mathbb{1}\{g(X) \neq Y\} - \mathbb{1}\{g^*(X) \neq Y\} is non-zero only on A. Its variance is therefore at most \mathbb{P}(A): a classifier with small excess risk has a small-variance excess loss. Bernstein’s inequality turns small variances into fast rates.

Theorem 9.3 — Bernstein’s inequality Let Z_1, \dots, Z_n be independent, with |Z_i - \mathbb{E} Z_i| \leq b and variances at most v. With probability at least 1 - \delta, \frac1n \sum_{i=1}^n (\mathbb{E} Z_i - Z_i) \leq \sqrt{\frac{2 v \log(1/\delta)}{n}} + \frac{2 b \log(1/\delta)}{3n} . Boucheron, Lugosi and Massart (2013) prove it by bounding the moment generating function, as for Hoeffding.

Theorem 9.4 — Fast rate for a finite class under Massart’s condition Let \mathcal{G} be finite with N elements and contain g^*, and assume Massart’s condition with h \in (0, 1]. With probability at least 1 - \delta, the ERM satisfies R(\hat g_n) - R^* \leq \Big(\frac{2}{h} + \frac{8}{3}\Big) \frac{\log(N/\delta)}{n} .

Proof. For each classifier g of the class, let Z_i(g) be the difference between its loss and the loss of g^* on the i-th example.

These variables take the values -1, 0 and 1. Their mean is \Delta_g = R(g) - R^*, and their variance is at most \Delta_g / h by Proposition 9.2.

  • Bernstein’s inequality with b = 2 and a union bound give, with L = \log(N/\delta) and for all g at once, \Delta_g - \frac1n \sum_i Z_i(g) \leq \sqrt{\frac{2 \Delta_g L}{h n}} + \frac{4L}{3n} .
  • For the ERM, the empirical mean of Z_i(\hat g_n) is non-positive, because g^* \in \mathcal{G}.
  • With \sqrt{ab} \leq a/2 + b/2, the inequality becomes \Delta \leq \Delta/2 + L/(hn) + 4L/(3n). ∎

Without the condition, Proposition 4.1 gives \sqrt{\log N / n}. Under the margin condition with exponent \alpha, the same argument with localization gives the intermediate rate (\log N / n)^{(1+\alpha)/(2+\alpha)} (Tsybakov, 2004), and local Rademacher complexities extend it to infinite classes (Bartlett, Bousquet and Mendelson, 2005).

Selecting a rule on held-out data

Proposition 9.5 — Hold-out selection Split the data: train M candidate rules on the first part, then select the candidate \hat g with the smallest error on a held-out part of size m. With probability at least 1 - \delta, R(\hat g) \leq \min_{j \leq M} R(\hat g_j) + \sqrt{\frac{2 \log(2M/\delta)}{m}} .

Proof. Given the first part, the M candidates are fixed classifiers. Apply Proposition 4.1 to them on the held-out sample, and integrate over the first part. ∎

Choosing k for nearest neighbours, the depth of a tree or the regularization of an SVM among M values thus costs \sqrt{\log M / m}. Cross-validation averages several splits to reduce the variance of the selection; its theory is surveyed by Arlot and Celisse (2010).

Algorithmic stability

Complexity measures look at the whole class. Stability looks only at the rule: how much does the output change when one example changes?

Definition 9.6 — Uniform stability (Bousquet and Elisseeff, 2002) A rule A is \beta-uniformly stable if, for all samples D and D^{(i)} that differ only in their i-th example, and for every pair z, \big|\ell(A(D), z) - \ell(A(D^{(i)}), z)\big| \leq \beta .

Proposition 9.7 — Stable rules generalize in expectation If A is \beta-uniformly stable, then \mathbb{E}\big[R(A(D_n)) - \hat R_n(A(D_n))\big] \leq \beta .

Proof. Let Z'_1, \dots, Z'_n be an independent copy of the sample, and let D^{(i)} be D_n with Z_i replaced by Z'_i.

  • The pairs (D_n, Z_i) and (D^{(i)}, Z'_i) have the same law, so the expected training error is the mean over i of \mathbb{E}\, \ell(A(D^{(i)}), Z'_i).
  • The expected risk is the mean over i of \mathbb{E}\, \ell(A(D_n), Z'_i), since Z'_i is independent of D_n.
  • Each difference is at most \beta by stability. ∎

Regularized ERM is stable. With a convex loss \varphi that is L-Lipschitz, inputs of norm at most \rho and the penalty \lambda \|w\|^2, it is stable with \beta = 2L^2\rho^2/(\lambda n) in the averaged sense used by Shalev-Shwartz and Ben-David (2014, ch. 13), which suffices for Proposition 9.7. The trade-off reappears: a large \lambda makes the rule stable but biased. Stability also explains why stochastic gradient descent with few passes generalizes (Hardt, Recht and Singer, 2016).

Key takeaways — chapter 9

  • Under a margin condition, small excess risk implies small disagreement with g^*, hence small variance of the excess loss.
  • Bernstein’s inequality turns this into rates between 1/\sqrt{n} and 1/n; under Massart’s condition a finite class gives \log(N/\delta)/(hn).
  • Hold-out selection among M rules costs \sqrt{\log M / m}.
  • Uniformly stable rules generalize, whatever the size of the class; regularization buys stability.

10. Research directions and open problems

This chapter, for self-study, surveys questions on which the theory of the previous chapters is being extended. It cites only the main references; the papers themselves give the precise statements.

Interpolation and benign overfitting

Zhang, Bengio, Hardt, Recht and Vinyals (2017) observed that deep networks trained by gradient descent fit random labels perfectly, yet generalize on real labels. For such interpolating predictors, the uniform bounds of ch. 4 are vacuous, and Nagarajan and Kolter (2019) argue that two-sided uniform convergence may be unable to explain this behaviour at all.

Belkin, Hsu, Ma and Mandal (2019) documented the double descent curve: the test error can decrease again beyond the interpolation threshold. Bartlett, Long, Lugosi and Tsigler (2020) characterized when the minimum-norm interpolant in linear regression is consistent, through effective ranks of the covariance. A sharp theory for classification with general features remains open.

Implicit bias of optimization

Soudry, Hoffer, Nacson, Gunasekar and Srebro (2018) proved that gradient descent on the logistic loss over separable data converges in direction to the hard-margin SVM solution. The optimization algorithm, not an explicit penalty, selects the predictor, and the margin theory of ch. 7 applies to it. Lyu and Li (2020) extended the result to homogeneous neural networks. Which implicit biases arise for other architectures and algorithms, and what they imply for generalization, is an active question.

PAC-Bayes and data-dependent bounds

PAC-Bayesian bounds (McAllester, 1999; Catoni, 2007) control the risk of a randomized predictor by the Kullback–Leibler divergence between a data-dependent posterior and a fixed prior. Dziugaite and Roy (2017) optimized such a bound to obtain the first non-vacuous guarantee for a stochastic deep network on MNIST. Alquier (2024) surveys the field. Tight bounds for the deterministic networks used in practice are still missing.

Distribution-free uncertainty

Conformal prediction (Vovk, Gammerman and Shafer, 2005) turns any predictor into prediction sets with exact finite-sample coverage under exchangeability; the split version is analysed by Lei, G’Sell, Rinaldo, Tibshirani and Wasserman (2018). Angelopoulos and Bates (2023) give an introduction. Conditional coverage, which is impossible in full generality, and coverage under distribution shift are open directions.

Ranking, scoring and U-statistics

Clémençon and Vayatis (2007) studied the problem of ranking only the best instances, where the criterion focuses on the beginning of the ROC curve. Empirical risks over all pairs cost O(n^2); Clémençon, Colin and Bellet (2016) showed that incomplete U-statistics built on a few random pairs keep the statistical rates. Consistent surrogates for partial-AUC criteria and for multipartite ranking are only partly understood.

Distribution shift and fairness

Ben-David, Blitzer, Crammer, Kulesza, Pereira and Vaughan (2010) bounded the risk on a target domain by the source risk plus a divergence between the domains. Hardt, Price and Srebro (2016) defined equality of opportunity, a constraint on the true positive rates of ch. 2 across groups, and showed how to enforce it by post-processing a score. Responsible Machine Learning develops these questions.

Theory of random forests

Biau, Devroye and Lugosi (2008) proved the consistency of simplified random forests, and Scornet, Biau and Vert (2015) the consistency of Breiman’s forests in additive regression models. Wager and Athey (2018) built confidence intervals for forest-based estimates of treatment effects. The consistency of Breiman’s original algorithm for general distributions is still open.

Questions to explore

Exercises

Levels: ★ apply the course, ★★ combine results or prove a short statement, ★★★ open-ended or research-flavoured. Exercises 6, 14 and 17 are computational.

  1. ★ A Bayes classifier with costs. The input takes three values a, b, c with the following probabilities and regression function:

    x a b c
    \mathbb{P}(X = x) 0.5 0.3 0.2
    \eta(x) 0.9 0.4 0.1

    Find the Bayes classifier and the Bayes risk, and the excess risk of the constant classifier +1. Then find the classifier that minimizes the cost-sensitive risk with cost 0.3 for a false positive.

    Solution: g^*(a) = +1 and g^*(b) = g^*(c) = -1, so R^* = 0.5 \times 0.1 + 0.3 \times 0.4 + 0.2 \times 0.1 = 0.19 .

    The constant +1 has risk \mathbb{P}(Y = -1) = 0.41. Theorem 1.3 gives the same excess, 0.3 \times 0.2 + 0.2 \times 0.8 = 0.22.

    With cost 0.3, Proposition 2.2 predicts +1 where \eta > 0.3, that is at a and b. Its cost-sensitive risk is 0.015 + 0.054 + 0.014 = 0.083, against 0.113 for g^*.

  2. ★ Bayes risk of Gaussian classes. In Example 1.5 with \sigma = 1, compute R^* for \|\mu\| = 1.5.

    Then take all coordinates of \mu \in \mathbb{R}^d equal to m = 0.2. Compute R^* for d = 25 and d = 100, and explain the result.

    Solution: R^* = \Phi(-1.5) = 0.0668. With \|\mu\| = m\sqrt{d}, the risk is \Phi(-1) = 0.1587 for d = 25 and \Phi(-2) = 0.0228 for d = 100.

    Many weakly informative independent features add up, provided the classifier weights them correctly. LDA (Proposition 3.1) has to estimate d coordinates of w to do so, which is where estimation error enters.

  3. ★ How many test points? How large must a test sample be for the test error to be within \pm 0.01 of the risk with probability 0.95? Compare with Chebyshev’s inequality.

    Solution: by Proposition 2.3, m \geq \log(40) / (2 \times 10^{-4}) = 18\,444; for \pm 0.02, 4611 points suffice.

    Chebyshev with \mathrm{Var} \leq 1/4 requires 1/(4 m \varepsilon^2) \leq 0.05, that is m \geq 50\,000. The exponential tail of Hoeffding’s inequality is worth a factor 2.7 here, and much more at smaller \delta.

  4. ★ VC dimensions. Compute the VC dimension of (a) axis-parallel rectangles in \mathbb{R}^2 (label +1 inside), and (b) unions of two intervals on the line.

    Solution: (a) V = 4. Four points in a diamond, (\pm 1, 0) and (0, \pm 1), are shattered. Among any five points, keep a leftmost, a rightmost, a lowest and a highest one; the smallest rectangle containing them contains the fifth, so the labelling with the fifth point negative and the others positive is impossible.

    1. V = 4. On sorted points, a union of two intervals realizes exactly the labellings with at most two blocks of +1. All labellings of four points have at most two such blocks, while (+, -, +, -, +) has three.
  5. ★ Two \psi-transforms. Derive H and \psi for the square loss and the exponential loss (Example 6.5). For an excess exponential risk of 0.005, bound the excess classification risk exactly and with \psi(\theta) \geq \theta^2/2.

    Solution: for the square loss, C_\eta(\alpha) is minimized at \alpha = 2\eta - 1, so H(\eta) = 4\eta(1 - \eta) and \psi(\theta) = 1 - (1 - \theta^2) = \theta^2.

    For the exponential loss, the minimizer is \frac12 \log(\eta/(1-\eta)), so H(\eta) = 2\sqrt{\eta(1-\eta)} and \psi(\theta) = 1 - \sqrt{1 - \theta^2}.

    Solving 1 - \sqrt{1 - \theta^2} \leq 0.005 gives \theta \leq \sqrt{1 - 0.995^2} = 0.0999. The quadratic bound gives \sqrt{0.01} = 0.1: almost the same.

  6. ★ Choosing k, in Python. Rerun the code of Example 3.8 with n = 2000 and k \in \{1, 3, 15, 45, 200, 1000, 1999\}. Explain both ends, and check the Cover–Hart bound.

    Hints and expected result: replace the loop of Example 3.8 by the following.

    import numpy as np
    from sklearn.neighbors import KNeighborsClassifier
    
    rng = np.random.default_rng(1)
    mu = np.array([1.0, 0.0])
    def sample(n):
        y = rng.choice([-1, 1], size=n)
        return y[:, None] * mu + rng.standard_normal((n, 2)), y
    
    X, y = sample(2000)
    Xte, yte = sample(20_000)
    for k in [1, 3, 15, 45, 200, 1000, 1999]:
        err = 1 - KNeighborsClassifier(n_neighbors=k).fit(X, y).score(Xte, yte)
        print(f"k = {k:4d}   test error = {err:.4f}")

    The errors are 0.223, 0.193, 0.170, 0.163, 0.158, 0.158 and 0.504. Small k has high variance, and k = 1 sits at the Cover–Hart limit 0.225, below 2R^*(1 - R^*) = 0.267.

    Large k still works here because the Bayes boundary is a line through the centre of the data, so even half of the sample is a good neighbourhood. At k = n - 1 the rule votes over the whole sample: it is a constant classifier with error 0.5.

  7. ★★ A sharper plug-in inequality. Show that the plug-in classifier satisfies R(\hat g) - R^* \leq 2\, \mathbb{E}\big[\,|\hat\eta(X) - \eta(X)|\; \mathbb{1}\{\hat g(X) \neq g^*(X)\}\big] . Deduce that under Massart’s condition |2\eta - 1| \geq h, R(\hat g) - R^* \leq \frac{4}{h}\, \mathbb{E}\big[(\hat\eta(X) - \eta(X))^2\big] .

    Solution: the first bound is the proof of Proposition 2.4 before dropping the indicator.

    Where \hat g \neq g^*, the estimate is on the other side of 1/2, so |\hat\eta - \eta| \geq |\eta - 1/2| \geq h/2. Hence \mathbb{1}\{\hat g \neq g^*\} \leq 2|\hat\eta - \eta| / h, and inserting this gives the result.

    The classification rate is now the square of the L^2 rate for \eta, instead of its square root.

  8. ★★ The perceptron bound is tight. Run the perceptron on the points e_1, \dots, e_d of \mathbb{R}^d with arbitrary labels. Count its mistakes and compare with Theorem 3.3.

    Solution: the unit vector w^* = \frac{1}{\sqrt d} \sum_j y_j e_j separates the data with margin \gamma = 1/\sqrt{d}, and \rho = 1, so the bound is (\rho/\gamma)^2 = d.

    In the first pass, w is a combination of the earlier, orthogonal e_j, so \langle w, e_i \rangle = 0 and each example triggers an update: d mistakes. After the pass, w = \sum_j y_j e_j classifies everything correctly, and the bound is attained.

  9. ★★ Rademacher complexity by hand. On two points x_1 < x_2, compute \hat{\mathfrak{R}}_2 for the thresholds x \mapsto \mathbb{1}\{x > t\} and for all functions with values in \{0, 1\}. Compare with Lemma 4.11.

    Solution: the threshold patterns are (0,0), (0,1) and (1,1).

    Consider the four sign vectors (+,+), (+,-), (-,+) and (-,-) in turn. The maxima of \sigma_1 a_1 + \sigma_2 a_2 over the patterns are 2, 0, 1 and 0.

    Their mean is 3/4, and dividing by n = 2 gives 0.375.

    With all four patterns, the maximum is (\sigma_1)_+ + (\sigma_2)_+, of mean 1, so \hat{\mathfrak{R}}_2 = 0.5. Massart’s lemma gives \sqrt{2}\, \sqrt{2 \log 3} / 2 = 1.05 for the thresholds: correct but vacuous, since the class has range 1.

  10. ★★ Sauer’s lemma is tight. Show that on an infinite set, the class of indicators of the subsets with at most V elements has VC dimension V and growth function exactly \sum_{i \leq V} \binom{n}{i}.

    Solution: on n distinct points, the traces are the subsets of at most V of these points: there are \sum_{i \leq V} \binom{n}{i} of them. A set of V points is shattered, since all its subsets are allowed; a set of V + 1 points is not, since the full set is missing.

  11. ★★ The perceptron loss is not calibrated. For \varphi(u) = \max(0, -u), compute C_\eta, H and H^-, and conclude. Then show that the squared hinge loss \max(0, 1 - u)^2 is calibrated and compute its \psi-transform.

    Solution: the conditional risk is piecewise linear, C_\eta(\alpha) = (1 - \eta)\, \alpha \ \text{ for } \alpha \geq 0, \qquad C_\eta(\alpha) = \eta\, |\alpha| \ \text{ for } \alpha \leq 0 .

    Its minimum is at \alpha = 0 for every \eta, so H = H^- = 0. The loss is not calibrated, in line with Theorem 6.3, since \varphi is not differentiable at 0.

    The constant f = 0 minimizes the risk, and the perceptron works only through its algorithm and separability.

    The squared hinge has \varphi'(0) = -2: calibrated. On [-1, 1] it coincides with the square loss, whose minimizer 2\eta - 1 lies there, so \psi(\theta) = \theta^2.

  12. ★★ AdaBoost forgets its last choice. Show that under the new weights w_{t+1}, the base classifier h_t has weighted error exactly 1/2. What does this imply for h_{t+1}?

    Solution: the weight of the examples misclassified by h_t becomes \frac{\varepsilon_t\, e^{\alpha_t}}{Z_t} = \frac{\varepsilon_t \sqrt{(1 - \varepsilon_t)/\varepsilon_t}}{2\sqrt{\varepsilon_t (1 - \varepsilon_t)}} = \frac12 . So h_t is no better than chance under the new weights, and AdaBoost never selects the same classifier twice in a row.

  13. ★★ AUC by hand. Three positives have scores 0.9, 0.7, 0.4 and three negatives 0.8, 0.3, 0.2. Compute the empirical AUC by counting pairs, by the rank formula, and as the area under the empirical ROC curve. Compute the empirical ranking risk L_n and relate it to the AUC.

    Solution: the score 0.9 beats the three negatives, 0.7 beats two and 0.4 beats two, so \widehat{\mathrm{AUC}} = 7/9 = 0.778.

    The positive ranks among the six scores are 6, 4 and 3, so the rank formula gives (13 - 6)/9 = 7/9. The ROC curve goes through (0, 1/3), (1/3, 1/3), (1/3, 1) and (1, 1), with area 1/9 + 2/3 = 7/9.

    Two unordered pairs are misordered, hence 4 of the 30 ordered pairs, and L_n = 0.133. The 18 ordered pairs with different labels make up 0.6 of all pairs, and 0.6 \times 2/9 = 0.133: the empirical analogue of Proposition 8.4.

  14. ★★ Exponential weights, in Python. Simulate 50 experts with Bernoulli losses of means drawn in [0.3, 0.5] over T = 5000 rounds. Compare the regret of exponential weights with the bound of Theorem 7.8 and with the uniform average; then vary \eta.

    Hints and expected result:

    import numpy as np
    
    rng = np.random.default_rng(5)
    T, M = 5000, 50
    q = rng.uniform(0.3, 0.5, size=M)                  # mean loss of each expert
    L = (rng.uniform(size=(T, M)) < q).astype(float)   # losses in {0, 1}
    eta = np.sqrt(8 * np.log(M) / T)
    
    cum, total = np.zeros(M), 0.0
    for t in range(T):
        w = np.exp(-eta * (cum - cum.min()))           # shift for numerical stability
        total += (w / w.sum()) @ L[t]
        cum += L[t]
    print(f"exponential weights regret {total - cum.min():6.1f}")
    print(f"uniform average regret     {L.mean(axis=1).sum() - cum.min():6.1f}")
    print(f"bound sqrt(T log M / 2)    {np.sqrt(T * np.log(M) / 2):6.1f}")

    The regret is 72.9, below the bound 98.9, while the uniform average loses 487.4. A much smaller \eta behaves like the uniform average: 231.5 at a tenth of the tuned value.

    A much larger \eta approaches follow-the-leader, which does even better here: 58.1 at ten times the tuned value, 55.3 at a hundred times. With independent losses the leader rarely changes. The tuning of Theorem 7.8 is a worst-case choice: on losses that alternate between two experts, follow-the-leader errs at every round and its regret grows linearly in T.

  15. ★★★ Fast rates under the margin condition. Let \mathcal{G} be finite and contain g^*, and assume the margin condition with exponent \alpha. Adapt the proof of Theorem 9.4 to show that, with probability at least 1 - \delta, R(\hat g_n) - R^* \leq C \Big(\frac{\log(N/\delta)}{n}\Big)^{(1+\alpha)/(2+\alpha)} , for a constant C depending on the margin constant and \alpha.

    Hints and expected result: by Proposition 9.2 the variance of the excess loss is at most c\, \Delta^\kappa, with \kappa = \alpha/(1 + \alpha). Bernstein’s inequality and the ERM property give \Delta \leq \sqrt{\frac{2 c\, \Delta^\kappa L}{n}} + \frac{4L}{3n} . If the first term dominates, \Delta^{1 - \kappa/2} \lesssim \sqrt{L/n}, so \Delta \lesssim (L/n)^{1/(2 - \kappa)}, and 1/(2 - \kappa) = (1 + \alpha)/(2 + \alpha).

    Otherwise \Delta \lesssim L/n, which is smaller. The exponent goes from 1/2 (\alpha = 0) to 1 (\alpha \to \infty).

  16. ★★★ A lower bound with one point. The input is a single point, and \eta = \frac12 + \varepsilon under P_+, \eta = \frac12 - \varepsilon under P_-. Show that every rule has, under one of the two, an expected excess risk of at least \varepsilon\, \big(1 - \mathrm{TV}(P_+^n, P_-^n)\big) . Using Pinsker’s inequality, deduce a lower bound of order 1/\sqrt{n}.

    Hints and expected result: predicting the wrong label costs |2\eta - 1| = 2\varepsilon. The sum of the probabilities of a wrong prediction under the two laws is at least 1 - \mathrm{TV}, which gives the first claim.

    For \varepsilon \leq 1/4, the divergence between the two sample laws satisfies \mathrm{KL}(P_+^n \,\|\, P_-^n) = 2n\varepsilon \log\frac{1 + 2\varepsilon}{1 - 2\varepsilon} \leq 16 n \varepsilon^2 . With \varepsilon = 1/(8\sqrt{n}), it is at most 1/4, so \mathrm{TV} \leq \sqrt{1/8} = 0.354, and the excess risk is at least 0.08/\sqrt{n}. On V shattered points, the same argument gives the \sqrt{V/n} of Theorem 5.5.

  17. ★★★ When a linear score cannot rank. On the concentric circles of scikit-learn, compare the AUC of a linear logistic score, of a random-forest score and of minus the radius. Relate the results to Theorem 8.3, then study the effect of the forest’s leaf size and of the training size.

    Hints and expected result:

    import numpy as np
    from sklearn.datasets import make_circles
    from sklearn.ensemble import RandomForestClassifier
    from sklearn.linear_model import LogisticRegression
    from sklearn.metrics import roc_auc_score
    
    X, y = make_circles(n_samples=4000, noise=0.2, factor=0.5, random_state=0)
    Xtr, ytr, Xte, yte = X[:1000], y[:1000], X[1000:], y[1000:]
    lin = LogisticRegression().fit(Xtr, ytr).decision_function(Xte)
    rf = RandomForestClassifier(n_estimators=300, min_samples_leaf=10, random_state=0)
    rf_s = rf.fit(Xtr, ytr).predict_proba(Xte)[:, 1]
    print("linear logistic score AUC:", round(roc_auc_score(yte, lin), 4))
    print("random forest score AUC  :", round(roc_auc_score(yte, rf_s), 4))
    print("minus the radius AUC     :", round(roc_auc_score(yte, -np.linalg.norm(Xte, axis=1)), 4))

    The AUCs are 0.492, 0.953 and 0.962. Here \eta is a decreasing function of the radius, so minus the radius is (nearly) an optimal score, while no linear score orders the points like \eta.

    The logistic population minimizer is optimal only within a model that contains an increasing transform of \eta. Studying how fast the forest’s AUC approaches the optimum, and comparing with a pairwise objective or TreeRank, is an open-ended project.

Projects and assessment

The official assessment, on master-mva.com, has two written parts: a partial exam (Part 1), which is mandatory, and a final exam (Part 2). A re-take, by written exam or by project, is proposed only to students who attended both parts. No weights are displayed. The Université Paris-Saclay course detail describes the assessment as “Evaluation Continue non Intégrale”.

The written exam below is a proposal in the spirit of both exams: Part 1 would cover ch. 0–4 and Part 2 the whole course. The solo subjects are sized for the re-take project or for personal study. The group subjects follow the MVA tradition of reproducing a research paper and presenting it orally.

Solo projects

  1. [Solo · ≈ 20 h] Calibration and comparison inequalities, measured. How tight is the comparison inequality of Theorem 6.4 for actual learning rules? A paper study of Bartlett, Jordan and McAuliffe (2006), with Zhang (2004).
    • Implement: on a two-dimensional model with a known regression function (two Gaussian classes with unequal covariances), minimize the empirical hinge, logistic, exponential and square risks over linear and quadratic features, for n from 100 to 10 000.
    • Measure: the excess classification risk and the excess surrogate risk, both by Monte Carlo, using the known \eta and R_\varphi^* = \mathbb{E}\, H(\eta(X)).
    • Deliverables: code, 4–6 page report, 10-minute talk. Chapters: ch. 1, 6.
    • Success criterion: the inequality holds on every run; the report plots both sides of it against n and explains when they are far apart.
  2. [Solo · ≈ 20 h] Stone’s theorem, proved and tested. Write a complete proof of the universal consistency of the k-NN rule, then test its limits. A paper study of Stone (1977) and Cover and Hart (1967), following the proofs of Devroye, Györfi and Lugosi (1996).
    • Prove: the variance and bias steps of Theorem 3.5, Stone’s lemma with an explicit constant, and the limit of Proposition 3.6.
    • Test: the excess risk against n for k = 1, k = \sqrt{n} and a hold-out choice of k (Proposition 9.5), in dimensions 2, 10 and 50, on Gaussian classes with a known Bayes risk.
    • Deliverables: a 6–8 page note with the proof, code, 10-minute talk. Chapters: ch. 2, 3, 5, 9.
    • Success criterion: a proof without gaps, and a figure showing how the convergence slows down as the dimension grows.
  3. [Solo · ≈ 20 h] How loose are generalization bounds? Compute the bounds of ch. 4, 6 and 7 for a linear SVM and for boosted stumps on real data, and compare them with test errors. A paper study of Bartlett and Mendelson (2002).
    • Data: the breast-cancer data set bundled with scikit-learn (569 points, 30 features, standardized on each training part), over 20 random train–test splits.
    • Compute: the VC bound (Corollary 4.12), the margin bound for linear classifiers (Theorem 4.10 with the ramp loss, Lemma 6.6 and Proposition 4.13) and the margin bound for boosting (Theorem 7.7), with empirical Rademacher complexities estimated by Monte Carlo.
    • Deliverables: code, 4–6 page report, 10-minute talk. Chapters: ch. 4, 6, 7.
    • Success criterion: a table of bounds against test errors, the margin \gamma that minimizes each bound, and an explanation of which term makes a bound vacuous when it is.

Group projects

  1. [Group of 2–3 · ≈ 30 h each] Boosting the margin, reproduced. Does the test error of AdaBoost keep falling after the training error reaches zero, and do margins explain it? A paper study of Schapire, Freund, Bartlett and Lee (1998), with the counterpoint of Breiman (1999).
    • Implement: AdaBoost with stumps and with depth-3 trees, written from scratch and checked against scikit-learn; the normalized margins Y_i F_T(X_i) / \sum_t \alpha_t at T = 5, 100 and 1000; Breiman’s arc-gv, which maximizes the minimum margin.
    • Data: the simulated data of make_hastie_10_2 in scikit-learn (Example 10.2 of Hastie, Tibshirani and Friedman, 2009) and the breast-cancer data set.
    • Split: member A writes the boosting code; B the margin distributions and the bound of Theorem 7.7; C, in a group of three, arc-gv and the comparison.
    • Deliverables: code, 8–10 page joint report, 20-minute talk. Chapters: ch. 6, 7.
    • Success criterion: the cumulative margin distributions of the 1998 paper, reproduced qualitatively, and Breiman’s observation that a larger minimum margin need not lower the test error.
  2. [Group of 2–3 · ≈ 30 h each] Bipartite ranking: TreeRank against surrogate minimization. Which method gets closest to the optimal ROC curve: a logistic plug-in score, pairwise RankBoost, or TreeRank? A paper study of Clémençon and Vayatis (2009), with Clémençon, Lugosi and Vayatis (2008).
    • Data: synthetic models with a known \eta, hence a known optimal ROC curve (Theorem 8.3): Gaussian classes with unequal covariances, and the circles of Exercise 17.
    • Implement: TreeRank with cost-sensitive tree splits (Proposition 2.2); RankBoost on an incomplete U-statistic built from random pairs; logistic regression on polynomial features.
    • Split: member A writes TreeRank; B RankBoost and the incomplete U-statistics; C, in a group of three, the evaluation: ROC curves, the sup-distance to the optimal curve, and bootstrap intervals for the AUC.
    • Deliverables: code, 8–10 page joint report, 20-minute talk. Chapters: ch. 2, 7, 8.
    • Success criterion: each method’s AUC within 0.01 of the optimum at n = 5000, or an explanation of why it cannot get there.
  3. [Group of 2 · ≈ 25 h each] Structural risk minimization against cross-validation. Do the penalties of ch. 5 select a classifier as well as cross-validation does? A paper study of Koltchinskii (2001), with the survey of Arlot and Celisse (2010).
    • Model: histogram classifiers on regular grids of m \times m cells in [0, 1]^2, for m = 1, \dots, 30, on synthetic data with a known \eta of varying smoothness.
    • Split: member A computes the VC penalty of Proposition 5.8 and the Rademacher penalty; member B implements hold-out and V-fold selection, and the oracle choice computed from the true risk.
    • Deliverables: code, 8-page joint report, 20-minute talk. Chapters: ch. 2, 4, 5, 9.
    • Success criterion: the ratio of the excess risk of each selected classifier to that of the oracle, reported over 50 samples for n from 200 to 20 000, and the oracle inequality of Proposition 5.8 checked on every sample.

Written exam (proposal)

Two hours, one handwritten A4 sheet allowed, no calculator needed beyond logarithms and square roots; four independent questions. This format is a proposal: the official pages do not describe it.

  1. Question (5 points). Let \eta(x) = \mathbb{P}(Y = 1 \mid X = x) in binary classification with labels \pm 1. Define the Bayes classifier g^* and prove that every classifier g satisfies R(g) - R^* = \mathbb{E}\big[\,|2\eta(X) - 1|\; \mathbb{1}\{g(X) \neq g^*(X)\}\big] . Deduce that a plug-in classifier built from \hat\eta has excess risk at most 2\, \mathbb{E}|\hat\eta(X) - \eta(X)|.

    Expected: the conditional error of g at x, compared with that of g^* (Theorem 1.3); then the observation that \eta and \hat\eta lie on different sides of 1/2 wherever the classifiers disagree (Proposition 2.4).

  2. Question (6 points). Let \mathcal{G} be the indicators of intervals [a, b] on the real line. (a) Compute its growth function and its VC dimension. (b) Bound the excess risk of the ERM with Corollary 4.12 for n = 10\,000 and \delta = 0.05. (c) Restrict the endpoints to the grid \{k/100\} and apply Proposition 4.1 instead. Comment.

    Expected: (a) S(n) = n(n+1)/2 + 1 and V = 2 (Example 4.4). (b) 0.123 + 0.027 = 0.151. (c) The class has 5151 + 1 = 5152 classifiers, so the bound is \sqrt{2 \log(2N/\delta)/n} = 0.049. The finite bound is three times smaller, but it ignores the approximation error that the grid adds.

  3. Question (5 points). Let \varphi be convex, differentiable at 0, with \varphi'(0) < 0. Prove that \varphi is classification-calibrated. For the hinge loss, compute H and the \psi-transform, and deduce a bound on the excess classification risk of \mathrm{sign}\, f.

    Expected: the proof of Theorem 6.3 (tangent at 0 below C_\eta, so H^- = \varphi(0) > H). For the hinge loss, H(\eta) = 1 - |2\eta - 1| and \psi(\theta) = \theta (Example 6.5). By Theorem 6.4, the excess classification risk is at most the excess hinge risk.

  4. Question (4 points). Prove that the training error of AdaBoost after T rounds is at most \prod_t 2\sqrt{\varepsilon_t(1 - \varepsilon_t)}. If every weighted error is at most 0.4 and n = 1000, after how many rounds is the training error guaranteed to be zero?

    Expected: the three steps of Theorem 7.4. With \gamma = 0.1, the training error is a multiple of 1/n, so it is zero once the bound is below 10^{-3}.

    The bound e^{-2\gamma^2 T} gives T \geq 346; the exact product 0.96^{T/2} gives T \geq 339.

Total: 5 + 6 + 5 + 4 = 20 points.

Grading rubric (proposal)

Criterion Weight What earns the marks
Mathematical understanding 30 % The learning problem, the assumptions and the main theorem are stated precisely, with the idea of the proof and the role of each constant
Correctness of proofs and code 25 % Proofs without gaps; code that runs from a fixed seed and is checked on a case with a known answer (a known Bayes risk, a known optimal ROC curve)
Experimental design and analysis 20 % Several samples or splits, error bars, comparison with the theoretical prediction, and honest reporting of what does not match
Written report and talk 15 % A clear structure within the page and time limits, readable figures, and the main message in the first paragraph
Answers to questions and teamwork 10 % Precise answers to “why does this bound hold?” and “what would break it?”; for groups, a visible and balanced split of the work

References

Official references (master-mva.com, 2026–2027)

Textbooks and surveys

Concentration, complexity and learnability (ch. 0, 4, 5)

Classical algorithms (ch. 3)

Convex surrogates (ch. 6)

Aggregation and ensembles (ch. 7)

Scoring and ranking (ch. 8)

Fast rates, model selection and stability (ch. 9)

Research directions (ch. 10)