Machine Learning Theory
Learning Theory Study Notes
Framing the Learning Problem
Core Assumptions
Data distribution: There exists a data generating distribution D from which (x,y) pairs are sampled. The training set and test-time examples are all drawn from the same distribution D. This is the foundational assumption for any learning theory.
Independent sampling: All samples are drawn independently from D. Together with the first assumption, this gives the i.i.d. (independent and identically distributed) setting.
The Learning Process
The learning process is modeled as:
A training set S={(x1,y1),(x2,y2),…,(xm,ym)} of m samples is drawn i.i.d. from D.
This set is fed into a learning algorithm (a deterministic function).
The output of the learning algorithm is a hypothesis h (or θ^) — a function that maps new inputs x to predictions y.
Key insight: S is a random variable. Since the learning algorithm is deterministic, the output hypothesis h is also a random variable. The distribution of h is called the sampling distribution.
True parameter θ∗ (or h∗) exists but is unknown. It is an unknown constant — not a random variable, but a fixed value that the learning algorithm aims to estimate.
The hypothesis is often parameterized (e.g., weights in logistic regression), but it can also be a non-parameterized function.
Bias-Variance Tradeoff
Data View vs. Parameter View
Data view: In regression, plots of x vs y show underfitting (high bias), overfitting (high variance), and "just right" fits.
Parameter view: More formal. Consider a two-dimensional parameter space (θ1,θ2). For a fixed sample size m, running the learning algorithm repeatedly (with different samples S) gives a set of θ^ points — samples from the sampling distribution.
Definitions
Bias: Measures whether the sampling distribution is centered around the true parameter θ∗. Formally, Bias(θ^)=E[θ^]−θ∗.
Variance: Measures the dispersion of the sampling distribution. Formally, Var(θ^)=E[(θ^−E[θ^])2].
High bias → the algorithm consistently stays away from θ∗ regardless of data. High variance → the algorithm is easily swayed by noise in the data.
Properties
Bias and variance are independent — an algorithm can have any combination of high/low bias and high/low variance.
As sample size m increases, variance tends to zero. The rate at which variance decreases is called statistical efficiency.
Consistency: If θ^→θ∗ as m→∞, the algorithm is consistent.
Unbiasedness: If E[θ^]=θ∗ for all m, the estimator is unbiased.
Fighting Variance
Get more data: Increasing m reduces variance naturally.
Regularization (L1, L2): Shrinks the hypothesis class, reducing the "wiggle room" for the estimator. This reduces variance but typically introduces a small amount of bias.
Fighting High Bias
Make the hypothesis class larger (e.g., use a more complex model). This reduces bias but usually increases variance.
Use a different algorithm.
The bias-variance tradeoff arises because steps that reduce bias (e.g., larger class) tend to increase variance, and steps that reduce variance (e.g., regularization, smaller class) tend to increase bias. The goal is to find the optimal balance that minimizes total generalization error.
Error Decomposition
Key Hypotheses
g: The best possible hypothesis (Bayes optimal) — minimizes the expected loss over D with infinite data.
h∗: The best in-class hypothesis — the best hypothesis within a chosen hypothesis class H (e.g., all logistic regression models).
h^: The hypothesis actually learned from finite data.
Types of Error
Define the risk (generalization error) of a hypothesis h as:
for classification (can be extended to regression). The empirical risk on a sample S is:
Bayes error ϵ(g): The irreducible error — even the best possible hypothesis may make mistakes (e.g., noisy labels).
Approximation error ϵ(h∗)−ϵ(g): The cost of restricting ourselves to a specific hypothesis class H. This is an attribute of the class.
Estimation error ϵ(h^)−ϵ(h∗): The error due to having only a finite sample S.
Decomposition Identity
The estimation error can be further decomposed into estimation bias and estimation variance.
Sometimes the "bias-variance decomposition" groups approximation error into bias and estimation error into variance, but they are not exactly the same.
Takeaway: Generalization error = irreducible error + cost of class restriction (approximation) + cost of finite data (estimation). Approximation error is fixed for a given class; estimation error decreases as m increases.
Empirical Risk Minimization (ERM)
ERM is a specific learning algorithm: chooses the hypothesis that minimizes the empirical risk (training error) on the given sample:
h^ERM=argminh∈Hϵ^S(h)This is what many algorithms (e.g., logistic regression with cross-entropy loss) approximately do.
Two central questions about ERM:
How does the empirical risk of a hypothesis relate to its generalization risk?
How does the generalization error of the ERM hypothesis compare to the best possible generalization error in the class (h∗)?
To answer these, we need tools from probability theory.
Uniform Convergence
Hoeffding's Inequality
For a Bernoulli distribution with parameter ϕ (bounded between 0 and 1), let Z1,…,Zm be i.i.d. samples. Let ϕ^=m1∑Zi. Then for any margin γ>0:
Applied to a fixed hypothesis h: treat each sample's error indicator 1{h(xi)=yi} as a Bernoulli variable with true mean ϵ(h). Then:
From Fixed h to All h in a Finite Class
Assume the hypothesis class H is finite with K=∣H∣. Using the union bound over all hypotheses:
Taking the complement, with probability at least 1−δ (where δ=2Ke−2γ2m), for all h∈H:
Sample Complexity
Fix γ and δ. Solving for m gives the sample complexity:
With at least this many samples, the gap between empirical and generalization error is bounded by γ for all hypotheses, with high probability.
Relating ERM to Best in Class
Using the uniform convergence bound, we can bound the generalization error of the ERM hypothesis h^:
ϵ(h^)≤ϵ^S(h^)+γ (by uniform convergence).
ϵ^S(h^)≤ϵ^S(h∗) (since h^ minimizes empirical risk).
ϵ^S(h∗)≤ϵ(h∗)+γ (again by uniform convergence).
Therefore:
Substituting γ=2m1logδ2K, we get the bound:
This shows that with enough data, the ERM hypothesis performs almost as well as the best hypothesis in the class.
Infinite Hypothesis Classes and VC Dimension
For infinite hypothesis classes (e.g., neural networks, linear classifiers with real-valued parameters), we cannot use K directly. Instead, we use the Vapnik-Chervonenkis (VC) dimension, which measures the capacity or expressiveness of a hypothesis class.
VC dimension d is the size of the largest set of points that can be shattered (all possible labelings realized) by the class.
A similar uniform convergence bound exists, with sample complexity scaling as O(d):
m≥O(γ2dlogδ1)
Key takeaway: The number of training examples needed to achieve good generalization is roughly proportional to the VC dimension of the hypothesis class. More complex models (higher VC dimension) require more data to avoid overfitting.
Summary of core theoretical results: Under i.i.d. assumptions, the generalization error of ERM is bounded by the best-in-class error plus a term that decreases as m increases — controlled by the size (K) or expressiveness (d) of the hypothesis class.

Ask anything
We've read this whole study set, so questions about it get the best answers.