Dictionary of Applied Machine Learning: 107 machine-learning terms, each with a definition, a figure, citations and a Python demo · All terms · Demos · Start here
Updated on 2026-10-22
Readiness 100/100
See also training set test set data point hypothesis loss validation error training error $k$-fold cross-validation model selection
A validation set consists of data points that have not been used for model training. For a learned hypothesis, the average loss on the validation set, the validation error, indicates how well the hypothesis predicts the labels of data points outside the training set. The validation error is used for model selection: the hypotheses learned by different machine learning (ML) methods are compared, and the one with the smallest validation error is selected. The selected hypothesis depends on the validation set, so assessing it requires a test set whose data points entered neither training nor selection. The size of the validation set determines how reliable the validation error is. When data points are scarce, $k$-fold cross-validation ($k$-fold CV) uses each fold of the dataset in turn as validation set and averages the $\nrfolds$ validation errors.

valset.py, which recomputes what the entry states: the script block by block · open in ColabB-dataConsider three days of weather recordings: for each day, the morning minimum temperature is the feature and the maximum daytime temperature is the label. Fig. 1 shows a training set $\trainset$ of three such days along with two hypotheses learned from it: the linear hypothesis $\learnthypothesis^{(1)}$ delivered by empirical risk minimization (ERM) on the linear model, and a degree-two polynomial $\learnthypothesis^{(2)}$ that passes through all three data points and therefore attains a training error of zero.
B-valsetThree further days, marked by open triangles, were held back from
model training: they form a validation set $\valset$.
The validation error of a hypothesis $\learnthypothesis$ learned
from the training set is its average loss on the validation
set (Shalev-Shwartz and Ben-David, 2014, Sect. 11.2.1),
\[
\frac{1}{|\valset|} \sum_{\datapoint \in \valset}
\lossfunc{\datapoint}{\learnthypothesis} \text{.}
\]
Here, $\lossfunc{\datapoint}{\learnthypothesis}$ is the loss
of $\learnthypothesis$ on the data point $\datapoint$. In
Fig. 1, the polynomial
$\learnthypothesis^{(2)}$ attains a training error of zero but a
validation error of $17.3$, while the linear hypothesis $\learnthypothesis^{(1)}$ has a training error of $2.9$ and a validation error of $3.0$.
pythondemos/valset.py
B-modelselAssessing the hypothesis learned from the model that
was chosen on the basis of the validation errors requires a third
dataset whose
data points entered neither training nor selection:
the test set $\testset$
(Hastie et al., 2009, Sect. 7.2). In
Fig. 2, the three days of the
test set, marked by open squares, yield a test error $\testerror = 1.3$ for
the selected hypothesis $\learnthypothesis^{(1)}$. The test error is
the only one of the three numbers that was not used to choose
anything, so it is not biased by selection. With only three test
days, however, it is itself a noisy estimate of the risk of
$\learnthypothesis^{(1)}$.
pythondemos/valset.py
B-verifyFor a loss with values in $[0,1]$ and a fixed hypothesis
$\learnthypothesis$, Hoeffding's inequality
(Shalev-Shwartz and Ben-David, 2014, Thm. 11.1) guarantees that, with probability at least $1 - \delta$ for a
confidence parameter $\delta \in (0, 1)$ chosen by the user, the
risk of $\learnthypothesis$ lies
within an uncertainty band of half-width $\epsilon$ around the
measured validation error. The guarantee requires that
\[
|\valset| \geq \frac{\ln(2/\delta)}{2 \epsilon^{2}} \text{.}
\]
Fig. 3 shows this lower bound as a
function of the half-width $\epsilon$ for three values of $\delta$;
it holds for any validation error, not only those of the weather
example. Narrowing the band is costly: halving $\epsilon$ quadruples
the required size. To have the validation error within $\epsilon = 0.1$
of the risk with $\delta = 0.1$, it suffices to hold back
$|\valset| \geq 150$ data points, the point of the dashed
curve at $\epsilon = 0.1$ in Fig. 3,
regardless of the hypothesis space and of the size of $\trainset$.
pythondemos/valset.py
Taken together, a typical ML workflow splits the available dataset three ways: a training set to learn hypotheses, a validation set to select among them (or the folds of $k$-fold CV in its place), and a test set, used only once, to assess the selected hypothesis.
See also: validation, training set, test set, data point, risk, hypothesis, loss, validation error, training error, $k$-fold cross-validation, leave-one-out cross-validation, model selection.
@misc{dictml_valset,
author = {Jung, Alexander},
editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
title = {validation set},
howpublished = {Dictionary of Applied Machine Learning (course edition)},
year = {2026},
doi = {10.5281/zenodo.21569296},
note = {ISBN 978-952-64-3013-3, CC BY 4.0, retrieved 2026-10-27},
url = {https://dictionaryofml.org/terms/valset.html}
}