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

training set

Updated on 2026-10-22

Readiness 100/100

▶ Run the Python demo Open in Colab Typeset PDF LaTeX source Cite this entry

See also training dataset validation set test set data point empirical risk minimization hypothesis loss training error validation error hypothesis space overfitting

A training set is a dataset used to train a model: it consists of data points for which the loss incurred by each candidate hypothesis can be evaluated, so that training methods can pick the hypothesis that performs best on it. Empirical risk minimization (ERM), for example, learns the hypothesis minimizing the average loss on the training set, the empirical risk, whose minimum value is the training error. Because the learned hypothesis is picked to perform well on the training set, a small training error can be misleading and result in overfitting. The validation error on a held-back validation set probes whether the learned hypothesis also predicts well outside the training set.

Figure produced by the Python demo of the entry training set
Figure written by the entry's Python demo trainset.py, which recomputes what the entry states: the script block by block · open in Colab

Definition

The ultimate goal of a machine learning (ML) method is to learn a hypothesis (or to train a model) that incurs a small prediction error not only on the data points used for training but on any data point that is typical for the application. The prediction error is measured by some loss function: the loss is a number, typically nonnegative, that quantifies the error of a hypothesis on a single data point, such as the squared difference between the predicted and the true label. The goal is formalized probabilistically as a small risk: the expected loss under the probability distribution from which the data points are drawn (independent and identically distributed assumption (i.i.d. assumption)). The method must therefore compare the candidate hypotheses from its hypothesis space on data points for which the loss can be evaluated. For example, in regression or classification, the loss can only be computed for data points with a known label. These data points form a dataset referred to as the training set, $\trainset = \{\datapoint^{(\sampleidx)}\}_{\sampleidx=1}^{\samplesize}$.

A training method is a map $\algomap$ whose input is the training set and whose output is a learned hypothesis, $\learnthypothesis = \algomap(\trainset)$. Training evaluates this map on the given training set. For example, empirical risk minimization (ERM) minimizes the average loss on the training set, the empirical risk, to learn a hypothesis \[ \learnthypothesis \in \argmin_{\hypothesis \in \hypospace} \frac{1}{\samplesize} \sum_{\sampleidx=1}^{\samplesize} \lossfunc{\datapoint^{(\sampleidx)}}{\hypothesis} \text{.} \] The empirical risk of the learned hypothesis is the training error.

B-ermConsider 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 of these three days along with two hypotheses learned from it: the linear hypothesis $\learnthypothesis^{(1)}$ delivered by 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.

Figure 1 of the entry trainset
Figure 1: Data points representing daily weather conditions: each data point is a day, with the morning minimum temperature as its feature and the maximum daytime temperature as its label. The three filled circles form the training set $\trainset$. Both curves are hypotheses learned from $\trainset$: the linear hypothesis $\learnthypothesis^{(1)}$ (solid curve) minimizes the average squared error on $\trainset$ over the linear model, while the dashed degree-two polynomial $\learnthypothesis^{(2)}$ passes through all three data points and attains a training error of zero. Both incur a small average loss on $\trainset$, but between and beyond the three circles the two curves are far apart: at the largest morning minimum temperature shown, the two predicted maximum temperatures differ by about seven degrees. Data generated by pythondemos/trainset.py
Which data points are contained in $\trainset$ decides what is learned. The choice of the training set is therefore crucial for trustworthy artificial intelligence (trustworthy AI): a training set that underrepresents a group of data points can yield a learned hypothesis that incurs a larger loss on that group, a source of unfairness (see fairness) (Barocas et al., 2023; Buolamwini and Gebru, 2018; Mehrabi et al., 2021).

B-polySince $\learnthypothesis$ is chosen to make the empirical risk small, the training error is typically smaller than the loss that the same hypothesis incurs on data points outside $\trainset$ (Hastie et al., 2009, Sect. 7.4). A small training error therefore does not guarantee a small loss outside the training set. Fig. 1 illustrates this: the polynomial $\learnthypothesis^{(2)}$ has a smaller training error than the linear hypothesis $\learnthypothesis^{(1)}$, so the training error prefers the polynomial. The figure shows no data points outside $\trainset$, but it shows that the two curves predict different labels for feature values between and beyond the three training data points. At most one of the two curves can therefore incur a small loss on a new data point with such a feature value, and the training error cannot tell which one (see overfitting).

B-misleadingA second subset of data points, the validation set $\valset$, is therefore held back from model training (Fig. 2): the average loss on $\valset$, the validation error, probes the learned hypothesis on data points it was not trained on. Comparing the two errors diagnoses the ML method: if both are small, the learned hypothesis is likely to predict well outside $\trainset$ as well. A small training error paired with a validation error far above it indicates overfitting; one typical cause is a hypothesis space that is too large for the number of data points in $\trainset$ (Bishop, 2006, Sect. 1.1; Hastie et al., 2009, Sect. 7.2).

Figure 2 of the entry trainset
Figure 2: The available dataset split into two disjoint subsets. Only the shaded subset, the training set $\trainset$, enters the training method $\algomap$ that delivers a learned hypothesis $\learnthypothesis$; the validation set is what remains to estimate how that hypothesis behaves on data points it was not trained on

See also: training, dataset, validation set, test set, data point, empirical risk minimization, hypothesis, loss, training error, validation error, hypothesis space, overfitting.

References

  1. Barocas et al. (2023). Fairness and Machine Learning: Limitations and Opportunities. MIT Press. fairmlbook.org/
  2. Buolamwini and Gebru (2018). Gender shades: Intersectional accuracy disparities in commercial gender classification. Proceedings of the 1st Conference on Fairness, Accountability and Transparency. proceedings.mlr.press/v81/buolamwini18a.html
  3. Mehrabi et al. (2021). A Survey on Bias and Fairness in Machine Learning. ACM Computing Surveys. doi.org/10.1145/3457607
  4. Hastie et al. (2009). The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Springer Science+Business Media. doi.org/10.1007/978-0-387-84858-7
  5. Bishop (2006). Pattern Recognition and Machine Learning. Springer Science+Business Media. doi.org/10.1007/978-0-387-45528-0

Cite this entry

@misc{dictml_trainset,
  author = {Jung, Alexander},
  editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
  title = {training 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/trainset.html}
}