ML&DL Notes: Learning Theory
A structured introduction to the central question of learning theory: when and why performance on a finite sample generalizes to unseen data. 2026-08-28 7 min read ML&DLMachine Learning note growing enLearning theory asks a deceptively simple question: when can good performance on a finite training set be trusted to generalize to unseen data? To answer it, we need precise definitions of error, a model of how data is sampled, and a way to describe the complexity of the hypotheses a learner may choose from.
This note develops those ideas in the following order:
- loss and population risk;
- the Bayes classifier and Bayes risk;
- empirical risk minimization from i.i.d. data;
- PAC learning and sample complexity;
- shattering, VC dimension, overfitting, and regularization.
1. The statistical learning setup
Let be the input space and the output space. A labeled example is a pair
where describes an object and is its target label. We assume that examples are drawn from an unknown joint distribution over .
A classifier is a function
The learner does not know . It must infer a useful classifier from a finite sample drawn from that distribution.
1.1 Loss
A loss function quantifies the cost of a prediction. For classification, the 0–1 loss records whether a prediction is wrong:
This loss treats every mistake equally. Other tasks may use different losses—for example, squared loss for regression or cross-entropy during classifier training.
1.2 Population risk
The population risk, also called the true risk or generalization error, is the expected loss on a fresh example from :
Under 0–1 loss, this expectation is exactly the probability of misclassification:
Population risk is the quantity we ultimately care about, but it cannot usually be computed because is unknown.
2. Bayes classifier and Bayes risk
For each input , the Bayes classifier chooses a label with the highest conditional probability:
Under 0–1 loss, this rule minimizes population risk among all measurable classifiers. Its risk,
is called the Bayes risk, and
for every classifier .
The Bayes risk need not be zero. If the same input can genuinely have different labels, some error is irreducible. A deterministic labeling rule is therefore a special, noise-free case rather than a default assumption.
3. Batch learning from data
In batch learning, the learner receives a fixed training set
and outputs a prediction rule . The goal is not merely to fit , but to perform well on new examples from the same population.
3.1 The i.i.d. assumption
The standard assumption is that
This means that the examples are independent of one another and identically distributed according to .

The i.i.d. assumption is the bridge between past observations and future data. If the deployment distribution differs substantially from the training distribution, standard generalization guarantees may no longer apply.
3.2 Empirical risk
Because population risk is unavailable, we estimate it using the average loss on the training set. The empirical risk is
For 0–1 loss,
where is the indicator function.
3.3 Empirical risk minimization
Given a hypothesis class , empirical risk minimization (ERM) selects
Low empirical risk alone is not enough: a class that is too expressive may memorize the sample. Learning theory studies the conditions under which empirical risk is a reliable proxy for population risk.
4. Probably Approximately Correct learning
PAC learning separates a guarantee into two tolerances:
- Approximately correct: the learned hypothesis may have population risk up to an accuracy tolerance .
- Probably correct: the guarantee may fail with probability at most over the random draw of the training sample.
Equivalently, the desired event should occur with probability at least .
4.1 Realizable PAC learning
The realizability assumption says that some hypothesis in labels the population perfectly. In other words, there exists such that
Under this assumption, is PAC learnable if there is an algorithm and a sample-complexity function such that, for every distribution satisfying realizability and every ,

The sample complexity may depend on , , and the class , but not on the unknown distribution itself. PAC learnability therefore means that a finite amount of data is sufficient to obtain a controlled generalization error with high confidence.
4.2 Agnostic PAC learning
Real-world data may contain noise, and may not include a perfect classifier. Agnostic PAC learning removes the realizability assumption and instead asks the learner to approach the best risk available within :

For a finite hypothesis class, standard uniform-convergence bounds have the qualitative form
in the agnostic setting. The important message is not the hidden constant, but the dependence: stronger accuracy and confidence requirements demand more data, while a larger hypothesis class carries a complexity cost.
4.3 Why boundedness matters
Many elementary concentration arguments assume a bounded loss. The 0–1 loss is bounded in , so it fits this framework directly. Squared loss is unbounded unless the predictions and targets are themselves restricted; it therefore requires additional assumptions or different tools.

5. Hypothesis-class complexity
Counting hypotheses works for finite classes, but many useful model families are infinite. Treating floating-point implementations as technically finite does not resolve the theoretical question: the guarantee should describe the mathematical class and explain which structural property controls generalization.
For binary classification, that property is often the VC dimension.
5.1 Shattering
Let . A binary hypothesis class shatters if it can realize every possible binary labeling of those points:
The hypothesis used may change from one labeling to another. Shattering does not require a single classifier to realize all labelings simultaneously.

5.2 VC dimension
The VC dimension of , written , is the largest size of a set shattered by . If arbitrarily large finite sets can be shattered, the VC dimension is infinite.
To prove that , it is enough to exhibit one set of points that can shatter. To prove that , one must show that no set of points can be shattered.
For affine linear classifiers in —hyperplanes with a bias term—

Under the standard measurability assumptions, a binary hypothesis class is distribution-free PAC learnable if and only if it has finite VC dimension. Infinite classes can therefore be perfectly learnable; what matters is their capacity, not whether they contain infinitely many functions.


6. Overfitting and regularization
Overfitting occurs when a model achieves very low training error but performs poorly on unseen data. It often arises when the selected hypothesis is too sensitive to the finite sample—especially when the class is highly expressive relative to the amount of data.

Regularization modifies ERM by penalizing complexity:
where measures some notion of complexity and controls the trade-off between fitting the sample and preferring a simpler hypothesis.

Regularization does not merely mean “make the model small.” The penalty encodes an inductive bias: a preference for hypotheses expected to generalize better. Examples include weight decay, sparsity penalties, margin maximization, early stopping, and data augmentation.
7. The central picture
The main objects of learning theory fit together as follows:
Empirical risk tells us how well fits observed data. PAC guarantees quantify the accuracy and confidence we can expect on unseen data. VC dimension measures whether the hypothesis class has enough capacity to overfit arbitrary labels. Regularization and class design then provide practical ways to manage that capacity.
The recurring lesson is that generalization depends on a balance among data quantity, hypothesis-class complexity, optimization, and assumptions about how the data is generated.