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 generalization independent and identically distributed assumption probability distribution training set test set transfer learning online learning
Distribution shift is a mismatch between the probability distribution underlying the training set and test set of a machine learning (ML) method and the probability distribution of the data points that the learned hypothesis faces after deployment. The average loss on the test set estimates the risk under the training probability distribution only, so a small test error is no evidence for a small loss on data points outside the test set. Factoring the joint probability distribution of features and labels separates the named special cases of covariate shift and label shift.

distshift.py, which recomputes what the entry states: the script block by block · open in ColabB-fetchThe Finnish Meteorological
Institute (FMI) station Helsinki Kaisaniemi records the minimum
and the maximum air temperature of each day. Every summer day is
a data point: its feature is the day's minimum
temperature, its label the day's maximum. A linear
hypothesis $\learnthypothesis(\feature) = 0.481\, \feature
+ 14.5$, learned from $62$ days of June–August 2026 by
minimizing the average squared error loss, reaches a training error
of $5.0$ and a test error of $6.5$ on a test set of the
$30$ remaining summer days. Deployed at the northernmost FMI
station, Utsjoki Nuorgam ($70.1^{\circ}$ N), on the $90$ days of
December 2025–February 2026, the same hypothesis incurs an
average error of $242.1$, which is $37$ times its test error
(Fig. 1). Every winter morning at
Nuorgam is colder than each summer morning in the training set,
and the extrapolation overshoots: the mean winter day at Nuorgam
has a minimum of $-19.8\,^{\circ}$C and a maximum of
$-9.6\,^{\circ}$C, while $\learnthypothesis$ assigns such a
morning a maximum of $+5.0\,^{\circ}$C.
pythondemos/distshift.py
Distribution shift is detected by comparing summary statistics of the features between the training set and the data points arriving after deployment, or by monitoring the incurred loss whenever labels become available (Quiñonero-Candela et al., 2009). One response is sample weighting: each data point of the training set is weighted by the ratio $p'(\featurevec)/p(\featurevec)$. This weighting corrects covariate shift under two conditions: the conditional $p(\truelabel \mid \featurevec)$ is unchanged, and every feature vector occurring under $p'$ also occurs under $p$, so that the ratio is defined (Quiñonero-Candela et al., 2009). Both conditions fail in the two-station example: no reweighting of summer days produces a winter morning at $-20\,^{\circ}$C. Responses that remain applicable are transfer learning and fine-tuning on data points from $p'$, domain adaptation, which uses unlabeled data points from $p'$ while the hypothesis is still being learned, and online learning, which updates the hypothesis as data points from the drifting probability distribution arrive (Quiñonero-Candela et al., 2009).
Synonyms: dataset shift, domain shift.
See also: generalization, independent and identically distributed assumption, probability distribution, risk, training set, test set, transfer learning, domain adaptation, sample weighting, online learning.
@misc{dictml_distshift,
author = {Jung, Alexander},
editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
title = {distribution shift},
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/distshift.html}
}