# machine learning pipeline (ML pipeline)

*Entry of the [Dictionary of Applied Machine Learning](https://dictionaryofml.org) (course edition), by Alexander Jung, Aalto University. CC BY 4.0. Updated 2026-10-29. [HTML](https://dictionaryofml.org/terms/mlpipeline.html) · [typeset PDF](https://dictionaryofml.org/terms/mlpipeline.pdf) · [LaTeX](https://dictionaryofml.org/terms/mlpipeline.tex) · [Python demo](https://dictionaryofml.org/terms/mlpipeline.py) · [notebook](https://dictionaryofml.org/terms/mlpipeline.ipynb)*

Math is LaTeX with the book's macros expanded, so no notation package is needed to read it.

## Abstract

A machine learning pipeline (ML pipeline) is the composition of the functions by which a machine learning system turns raw data into predictions. Its stages typically are data preprocessing, feature learning or hand-designed feature extraction, model training, and inference on new data points. Each stage is a function whose output is the input of the next, so the whole pipeline is one map from raw data to predictions and is applied identically during training and in deployment. Fitting stages such as feature scaling inside the pipeline, on the training set only, prevents data leakage from the validation set or test set.

## Definition

The weather station Krems an der Donau reports eight measurements of each day to the GeoSphere Austria data hub. Turning that stream into a forecast of tomorrow's minimum temperature takes four steps: cleaning the records, extracting features, training a model, and computing the prediction. The sequence of such steps is an ML pipeline: a composition (i.e., concatenation) of several functions within a machine learning system. The individual functions include data preprocessing, feature learning or hand-designed feature extraction, model training, and inference on new data points. By combining them, a machine learning system turns raw data into predictions (Hapke and Nelson, 2020) (Fig. 1).

Written as math, a pipeline of three stages is the concatenation

\begin{equation}
\tag{1}
h = h^{(3)} \circ h^{(2)}
\circ h^{(1)}
\text{,}
\end{equation}

with $h^{(1)}$ the feature map, $h^{(2)}$ the hypothesis applied to the resulting features, and $h^{(3)}$ the post-processing of its output. Of the four steps above, cleaning and feature extraction form $h^{(1)}$, the trained hypothesis is $h^{(2)}$ (training is how it is chosen, not a factor of $h$), and the post-processing of the prediction is $h^{(3)}$. Each factor is chosen from a hypothesis space of its own, $h^{(j)} \in \mathcal{H}^{(j)}$ for $j = 1, 2, 3$. The concatenations Eq. (1) are themselves a hypothesis space,

$$
\mathcal{H} = \bigl\{
h^{(3)} \circ h^{(2)} \circ
h^{(1)} \; : \;
h^{(j)} \in \mathcal{H}^{(j)},
\; j = 1, 2, 3
\bigr\}
\text{,}
$$

so training the pipeline is empirical risk minimization over $\mathcal{H}$ rather than over any one stage.

Each stage is a function whose output is the input of the next, so the pipeline is one map from raw data to predictions, applied identically during training and in deployment. Stages with their own parameters, such as feature scaling, are fitted on the training set only. Fitting them on all available data leaks information from the validation set or the test set into the learned hypothesis, so that the validation error or the error on the test set underestimates the risk (see data leakage). Software libraries therefore bundle the stages into one object that is trained as a whole on the training set (Pedregosa et al., 2011). The pipeline is the computational part of a machine learning system, which additionally comprises data storage, deployment, and monitoring.

![Figure 1 of the entry mlpipeline](https://dictionaryofml.org/terms/fig/mlpipeline-fig1.svg)

*Figure 1: An ML pipeline as a concatenation of functions Eq. (1), the output of each stage the input of the next, with the Krems forecast of the text named under each stage. The three stages drawn with a dashed border carry parameters of their own and are fitted on the training set only, which is what prevents data leakage from the validation set or test set into the learned hypothesis*

**See also:** function, machine learning system, preprocessing, [feature learning](https://dictionaryofml.org/terms/featlearn.html), inference, [data leakage](https://dictionaryofml.org/terms/dataleakage.html), [training set](https://dictionaryofml.org/terms/trainset.html), [hypothesis space](https://dictionaryofml.org/terms/hypospace.html), [empirical risk minimization](https://dictionaryofml.org/terms/erm.html).

## References

- Hapke and Nelson (2020). Building Machine Learning Pipelines: Automating Model Life Cycles with TensorFlow. *O'Reilly Media*.
- Pedregosa et al. (2011). Scikit-learn: Machine Learning in Python. *Journal of Machine Learning Research*. <https://www.jmlr.org/papers/v12/pedregosa11a.html>

## Cite this entry

```bibtex
@misc{dictml_mlpipeline,
  author = {Jung, Alexander},
  editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
  title = {machine learning pipeline (ML pipeline)},
  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-11-03},
  url = {https://dictionaryofml.org/terms/mlpipeline.html}
}
```
