Dictionary of Applied Machine Learning: 114 machine-learning terms, each with a definition, a figure, citations and a Python demo · All terms · Demos · Start here
Updated on 2026-10-29
Readiness 100/100
See also random variable probability distribution empirical risk minimization linear regression
The mean of a random vector ${\mathbf x}$ is its expectation, the Lebesgue integral of ${\mathbf x}$ with respect to its probability distribution. The term also refers to the sample mean, i.e., the average of the data points in a dataset. The two usages are consistent: the sample mean is the mean of the random vector obtained by drawing a data point uniformly from the dataset. Both usages share a further characterization: for a random vector with a finite second moment, the mean is the unique solution of a risk minimization problem under the squared error loss. For the random vector from a dataset, this optimization problem reduces to empirical risk minimization (ERM) in the simplest regression setting: predicting a numeric label without features, for which the learned hypothesis is the sample mean of the labels.

mean.py, which recomputes what the entry states: the script block by block · open in ColabA weather station records the daily maximum temperature for a year. Adding the $365$ numbers and dividing by $365$ returns a single value that summarizes the whole record. This is the mean of the recorded numbers, and the same word names the corresponding quantity for a probability distribution.
P-defThe mean of a random vector ${\mathbf x}$, which takes on values in a Euclidean space $\mathbb{R}^{d}$, is its expectation $\mathbb{E}\{{\mathbf x}\}$. It is the Lebesgue integral of ${\mathbf x}$ with respect to its probability distribution $\mathbb{P}$ (e.g., see Billingsley (1986) or Rudin (1987)), i.e., \[ \mathbb{E}\{{\mathbf x}\} = \int_{\mathbb{R}^{d}} {\mathbf x} \, \mathrm{d}\mathbb{P}({\mathbf x}) \text{.} \] Here, $\mathbb{P}$ is the probability distribution that ${\mathbf x}$ induces on $\mathbb{R}^{d}$, so the integral runs over the values ${\mathbf x}$ takes rather than over the underlying sample space. No probability density function (pdf) need exist for the mean to be defined; when one does, denoted by $p$, it is $\int_{\mathbb{R}^{d}} {\mathbf x} \, p({\mathbf x}) \, \mathrm{d}{\mathbf x}$.
P-argminThe average of the opening paragraph is the sample mean of a finite dataset
of sample size $m$,
$\mathcal{D} = \left\{ {\mathbf x}^{(1)}, \,\ldots, \,{\mathbf x}^{(m)} \in \mathbb{R}^{d}\right\}$.
These two usages are consistent. A dataset defines a
discrete random variable (discrete RV) $\widetilde{{\mathbf x}}^{(\mathcal{D})}={\mathbf x}^{(I)}$ on
the sample space $\{1, \,\ldots, \,m\}$. Here, the index $I$ is
chosen uniformly at random, i.e., $\mathbb{P}\left(I=r\right)=1/m$ for all
$r=1,\ldots,m$. The mean of $\widetilde{{\mathbf x}}^{(\mathcal{D})}$ is
precisely the sample mean
\[
({1}/{m}) \sum_{r=1}^{m}
{\mathbf x}^{(r)} \text{.}
\]
The probability distribution of $\widetilde{{\mathbf x}}^{(\mathcal{D})}$, which
places mass $1/m$ on each data point, is the
empirical distribution of the dataset.
Fig. 1 shows both readings for a
real-valued random variable (RV) and a dataset of seven numbers, with the
empirical distribution drawn as its cumulative distribution function (cdf).
P-robustFor the discrete RV that a dataset defines, the
risk is the average squared error over the dataset,
so this risk-minimization characterization applies directly
to the simplest machine learning (ML) problem, predicting a numeric label
without any features. Consider a training set
$\mathcal{D}^{(\rm train)} = \big\{ y^{(1)}, \,\ldots, \,y^{(m)} \big\}$
that consists of labels
$y^{(r)} \in \mathbb{R}$ only. A hypothesis
is then a single number $h \in \mathbb{R}$ that serves as
the prediction for every data point. Empirical risk minimization (ERM) with
the squared error loss searches over candidate hypotheses
$h' \in \mathbb{R}$ and learns
\[
\widehat{h}
= \mathop{\mathrm{arg\,min}}_{h' \in \mathbb{R}}
\frac{1}{m} \sum_{r=1}^{m}
\big(y^{(r)} - h'\big)^{2}
= \frac{1}{m} \sum_{r=1}^{m}
y^{(r)} \text{,}
\]
i.e., the learned hypothesis is the sample mean of
the labels (see Fig. 2). This setting
coincides with linear regression for data points that carry
the constant scalar feature $x = 1$.
pythondemos/mean.py).
Synonyms: expectation, expected value.
See also: random variable, random vector, expectation, sample mean, probability distribution, Lebesgue integral, empirical risk minimization, squared error loss, linear regression, median, trimmed mean.
@misc{dictml_mean,
author = {Jung, Alexander},
editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
title = {mean},
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-04},
url = {https://dictionaryofml.org/terms/mean.html}
}