Dictionary of Applied Machine Learning: 114 machine-learning terms, each with a definition, a figure, citations and a Python demo · All terms · Demos · Start here
Updated on 2026-10-29
Readiness 100/100
See also independent and identically distributed assumption training set overfitting regularization
Generalization is the ability of a machine learning (ML) method to make accurate predictions on data points that have not been used during training. Many ML methods implement training via empirical risk minimization (ERM), i.e., learning a hypothesis $\widehat{h}$ that minimizes the empirical risk on the training set $\mathcal{D}^{(\rm train)}$. The learned $\widehat{h}$ is then used to compute predictions on new data points outside $\mathcal{D}^{(\rm train)}$. A probabilistic model for data generation quantifies the prediction errors beyond $\mathcal{D}^{(\rm train)}$ via the risk of $\widehat{h}$, i.e., the expected loss incurred on a new randomly chosen data point. The difference between the risk and the empirical risk is the generalization gap. The stability of the ML method bounds the expected generalization gap without reference to the size of the hypothesis space. A complementary deterministic view characterizes generalization via the robustness of $\widehat{h}$: its prediction changes by at most a bounded multiple of a perturbation of the features of a data point.

generalization.py, which recomputes what the entry states: the script block by block · open in ColabP-goalA weather forecaster trained on past data is useful only if its predictions are accurate on data points that did not belong to the training set. Generalization refers to the ability of a learned hypothesis $\widehat{h}$ to make similarly accurate predictions on data points that have not been used during training. It is the central goal of machine learning (ML): learning patterns in the features and labels of data points that extend beyond the training set.
P-ermThe canonical learning technique is empirical risk minimization (ERM): the machine learning system (ML system) obtains $\widehat{h} \in \mathcal{H}$ by minimizing the empirical risk on the training set $\mathcal{D}^{(\rm train)}$. A low empirical risk on $\mathcal{D}^{(\rm train)}$ does not guarantee accurate predictions on data points outside $\mathcal{D}^{(\rm train)}$. The same question arises for online learning and Bayesian inference, where the training set is replaced by the data points processed so far or by a prior.
P-stableStudying generalization mathematically requires formalizing
the notion of data points outside the training set. A widely
used approach is to assume a probabilistic model for the
generation of data points, such as the
independent and identically distributed assumption (i.i.d. assumption). Here, data points are interpreted as
independent random variables (RVs) with an identical, fixed but
unknown, probability distribution $\mathbb{P}$.
Fig. 1 sketches this setup:
the shaded ellipse depicts the region of typical
data points under $\mathbb{P}$, and the two large
filled circles are the data points of the
training set that ERM fits with the learned
hypothesis $\widehat{h}$, and the arrows are small
perturbations of them. The risk of
$\widehat{h}$ is the expected loss:
\[
\bar{L} \big( \widehat{h} \big) = \mathbb{E}
\left\{ L\left({\mathbf z},\widehat{h} \right) \right\}.
\]
The difference $\bar{L} \big( \widehat{h} \big) -
\widehat{L}\big(\widehat{h}|\mathcal{D}^{(\rm train)}\big)$ is the generalization gap.
Probability theory is not the only route to generalization. A complementary deterministic approach uses robustness: a good hypothesis $\widehat{h}$ should change its prediction $\widehat{h}({\mathbf x})$ by at most a bounded multiple of the perturbation of the feature vector ${\mathbf x}$ of a data point ${\mathbf z}$, i.e., it should be Lipschitz. For example, an object detection system trained on smartphone photos should still detect the object if a single pixel is changed. Trained deep nets have been shown to lack this property (Su et al., 2019). The system should also deliver the same result if the object in the image is slightly translated or deformed (Mallat, 2016, Sect. 3). The arrows in Fig. 1 indicate small perturbations of each data point in the training set of an ML method.
See also: generalization gap, risk, empirical risk, independent and identically distributed assumption, training set, overfitting, regularization, stability.
Published version: doi.org/10.1007/978-981-92-2012-0_7-1, in Dictionary of Applied Machine Learning (Springer Nature Singapore). Please cite that version. This page corresponds to version 1 of that entry.
@incollection{dictml_generalization,
author = {Jung, Alexander},
editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
title = {generalization},
booktitle = {Dictionary of Applied Machine Learning},
publisher = {Springer Nature Singapore},
year = {2026},
doi = {10.1007/978-981-92-2012-0_7-1},
isbn = {978-981-92-2012-0},
url = {https://doi.org/10.1007/978-981-92-2012-0_7-1}
}