Dictionary of Applied Machine Learning
Updated on 2026-09-08
Typeset PDF version — the authoritative form of this entry
Python demo — a script that recomputes what this entry states and prints one line per check
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.
B-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)$, which corrects covariate shift provided that the conditional $p(\truelabel \mid \featurevec)$ is unchanged and that 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'$, 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, sample weighting, online learning.
@misc{dictml_distshift,
author = {Jung, Alexander and 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-09-11},
url = {https://dictionaryofml.org/terms/distshift.html}
}