Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Generalization

1. Statistical Framework: MLE vs. MAP

The choice of learning algorithm can be viewed through a probabilistic lens based on the likelihood and prior assumptions.

Likelihood p(y∣x,w)p(y|x,w)Prior p(w)p(w)Resulting Method
GaussianUniformOrdinary Least Squares (MLE)
GaussianGaussianRidge Regression (MAP)
GaussianLaplaceLasso Regression (MAP)
LaplaceUniformRobust Regression (l1l_1 loss)

Key Property: Maximum A Posteriori (MAP) estimation reduces to Maximum Likelihood Estimation (MLE) when the prior p(w)p(w) is uniform.


2. Generalization Terminologies

Egen(f)=E(x,y)∼P[(f(x)−y)2]E_{gen}(f) = \mathbb{E}_{(x,y) \sim P}[(f(x) - y)^2]

Training Error: The average loss on the finite training set DD.

E^train(f)=1m∑i=1m(f(xi)−yi)2\hat{E}_{train}(f) = \frac{1}{m} \sum_{i=1}^m (f(x_i) - y_i)^2

Generalization Gap: The difference between generalization error and training error.

Excess Risk: Measures how much worse a learned model ff performs compared to the Bayes optimal predictor f∗f^*.

Excess Risk=Egen(f)−Egen(f∗)Excess\ Risk = E_{gen}(f) - E_{gen}(f^*)

3. Excess Risk Decomposition

Excess risk can be split into three fundamental components:

  1. Approximation Error: The gap between the best-in-class predictor fˉ\bar{f} and the Bayes optimal f∗f^*. It reflects the limitation of the model class F\mathcal{F}.

  2. Estimation Error: The gap between the empirical risk minimizer fD∗f^*_D and the best-in-class predictor fˉ\bar{f}. It results from learning from a finite dataset.

Optimization Error: The gap between the approximate solution f^D\hat{f}_D returned by an algorithm and the true empirical minimizer fD∗f^*_D.


4. Mathematical Proof: Bias-Variance Decomposition

Assume the true target is y=t(x)+ϵy = t(x) + \epsilon where ϵ∼N(0,σ2)\epsilon \sim \mathcal{N}(0, \sigma^2). Let hDh_D be the hypothesis learned from dataset DD, and hˉ(x)=ED[hD(x)]\bar{h}(x) = \mathbb{E}_D[h_D(x)] be the expected hypothesis.

Proof Step 1: Decomposition of Expected Error at xx

Ey,D[(hD(x)−y)2]=Ey,D[(hD(x)−hˉ(x)+hˉ(x)−y)2]\mathbb{E}_{y,D}[(h_D(x) - y)^2] = \mathbb{E}_{y,D}[(h_D(x) - \bar{h}(x) + \bar{h}(x) - y)^2]
=Ey,D[(hD(x)−hˉ(x))2]+Ey,D[(hˉ(x)−y)2]+2Ey,D[(hD(x)−hˉ(x))(hˉ(x)−y)]= \mathbb{E}_{y,D}[(h_D(x) - \bar{h}(x))^2] + \mathbb{E}_{y,D}[(\bar{h}(x) - y)^2] + 2\mathbb{E}_{y,D}[(h_D(x) - \bar{h}(x))(\bar{h}(x) - y)]

The cross term vanishes because ED[hD(x)−hˉ(x)]=0\mathbb{E}_D[h_D(x) - \bar{h}(x)] = 0.

Proof Step 2: Decomposing the second term

Ey[(hˉ(x)−y)2]=Ey[(hˉ(x)−t(x)+t(x)−y)2]\mathbb{E}_y[(\bar{h}(x) - y)^2] = \mathbb{E}_y[(\bar{h}(x) - t(x) + t(x) - y)^2]
=(hˉ(x)−t(x))2+Ey[(t(x)−y)2]+2Ey[(hˉ(x)−t(x))(t(x)−y)]= (\bar{h}(x) - t(x))^2 + \mathbb{E}_y[(t(x) - y)^2] + 2\mathbb{E}_y[(\bar{h}(x) - t(x))(t(x) - y)]

The cross term vanishes because Ey[t(x)−y]=0\mathbb{E}_y[t(x) - y] = 0.

Final Result:

Ey,D[(hD(x)−y)2]=ED[(hD(x)−hˉ(x))2]⏟Variance+(hˉ(x)−t(x))2⏟Bias2+Ey[(t(x)−y)2]⏟Irreducible Noise\mathbb{E}_{y,D}[(h_D(x) - y)^2] = \underbrace{\mathbb{E}_D[(h_D(x) - \bar{h}(x))^2]}_{\text{Variance}} + \underbrace{(\bar{h}(x) - t(x))^2}_{\text{Bias}^2} + \underbrace{\mathbb{E}_y[(t(x) - y)^2]}_{\text{Irreducible Noise}}

.


5. Underfitting, Overfitting, and Regularization

Underfitting (High Bias): Model is too simple to capture the underlying structure. Remedied by increasing model complexity or adding informative features.

Overfitting (High Variance): Model fits training noise. Remedied by collecting more data or reducing complexity.

Regularization: Explicitly penalizes complexity Ω(f)\Omega(f).


6. The “Double Descent” Phenomenon

Modern machine learning (e.g., deep learning) often operates in the overparameterized regime where the number of parameters pp exceeds the number of samples mm.

Double Descent: Beyond the interpolation threshold, increasing model complexity further can actually decrease the test error again, contradicting the classical trade-off.