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 validation set model selection generalization data leakage empirical risk minimization
A test set consists of data points used to evaluate the performance of a hypothesis delivered by a machine learning (ML) method. These data points are used neither for training nor for model selection, which is why a test set is also called a hold-out set. Under the independent and identically distributed assumption (i.i.d. assumption), the average loss on the test set is an unbiased estimator of the risk of the learned hypothesis, and a concentration inequality bounds its deviation from the risk in terms of the test-set size. This yields a guideline for splitting a dataset: make the test set and the validation set just large enough for the required precision and train on the rest. The estimate stays valid only as long as no design choice depends on the test set; repeated evaluation with selection turns it into a validation set, and overlap with the training set constitutes test set contamination.

testset.py, which recomputes what the entry states: the script block by block · open in ColabP-tuningConsider a machine learning (ML) method that reads in weather recordings from the station Krems an der Donau (Austria) and delivers a hypothesis $\learnthypothesis$ that predicts the next day's maximum temperature from the current day's. Assessing the quality of $\learnthypothesis$ requires applying it to data points that the method has not used: the method typically uses a training set for learning a hypothesis via empirical risk minimization (ERM) and a validation set for comparing the hypotheses learned from different models. The data points of these two sets have tuned the learned hypothesis, which therefore typically incurs a smaller loss on them than on other data points.
A test set $\testset$ is a dataset of data points used to evaluate the performance of a hypothesis delivered by an ML method. Its data points enter neither the training of a model, e.g., via ERM on the training set $\trainset$, nor the model selection based on a validation set $\valset$ (Fig. 1). Since its data points are held back from training and model selection, a test set is also referred to as a hold-out set; some texts use that name for the validation set instead (Shalev-Shwartz and Ben-David, 2014, Sect. 11.2).
P-sizeFor a
hypothesis
$\learnthypothesis$ that was learned and selected without reference
to $\testset$, the test error is the average loss
\[
\frac{1}{|\testset|} \sum_{\datapoint \in \testset}
\lossfunc{\datapoint}{\learnthypothesis} \text{.}
\]
Interpreting the data points of $\trainset$, $\valset$, and
$\testset$ as realizations of independent and identically distributed (i.i.d.) random variables (RVs) with a
common probability distribution $p(\datapoint)$ (the independent and identically distributed assumption (i.i.d. assumption)), the
test error is an unbiased estimator of the risk of
$\learnthypothesis$ (Hastie et al., 2009). The distinction
from the validation set is the direction of information flow: the
validation error flows back into the choice of $\learnthypothesis$, so
it is an optimistic estimate for the chosen candidate. The test
error is computed once, after all choices are frozen, and flows
back into nothing.
Synonyms: hold-out set.
See also: training set, validation set, model selection, risk, generalization, test set contamination, data leakage, empirical risk minimization.
@misc{dictml_testset,
author = {Jung, Alexander},
editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
title = {test 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/testset.html}
}