A random experiment is a physical or computational data-generating process that produces an outcome $\omega$
from a known set of possibilities, the sample space of the experiment. Probability theory represents the
process by a probability space $(\Omega,\, \Sigma,\, \mathbb{P})$, where the $\sigma$-algebra $\Sigma$ collects the measurable
events and the probability measure $\mathbb{P}\left(\cdot\right)$ assigns each event a probability. This representation is a
probabilistic model of the process, not a property of it. A measurement of the outcome is represented by a random variable (RV),
a measurable function $x : \Omega \to \mathcal{X}$, and the measured value
$x(\omega)$ is a realization. Repeating the experiment $m$ times is itself a random
experiment on the product sample space, and the measurements of the runs are modeled as
independent and identically distributed (i.i.d.)RVs. In machine learning (ML), the construction of a training set, the draw of a subset of it by stochastic gradient descent (SGD), and the
noise added for differential privacy (DP) are random experiments.
B-januaryThe weather station Krems an der Donau (Austria) records the air
temperature at $06{:}00$ and at $15{:}00$ (UTC) of every day
(Fig. 1). On any
given day neither temperature is known in advance, but the range they can take is. A process of that
kind is a random experiment: it produces an outcome $\omega$ from a set $\Omega$ of
possibilities, the sample space of the experiment (Bertsekas and Tsitsiklis, 2008, Sect. 1.2; Billingsley, 1986).
The outcome is uncertain, and the experiment can be repeated under identical conditions. Here one
day is one run: the outcome $\omega$ is the weather of that day, and the two recorded temperatures are measurements of it.
Figure 1: The air temperature at $15{:}00$ (solid stems, filled
circles) and at $06{:}00$ (UTC) (dotted stems, open circles) of every day of
January 2023 at the weather station Krems an der Donau
(Austria). Each day is one run of the same random experiment:
the outcome is the weather of that day, and the two
temperatures are measurements of it. The month as a whole can
instead be read as a single random experiment, whose
outcome is the ordered list of the $31$ daily
outcomes. Data
generated by
pythondemos/randomexperiment.py
Probability theory represents a random experiment by a probability space $(\Omega,\, \Sigma,\, \mathbb{P})$ (Bertsekas and Tsitsiklis, 2008, Sect. 1.2; Billingsley, 1986, Sect. 2).
The sample space $\Omega$ collects the possible outcomes $\omega \in \Omega$.
The $\sigma$-algebra $\Sigma$ collects the events, those subsets $\mathcal{A} \subseteq \Omega$
to which a probability is assigned. The probability measure $\mathbb{P}\left(\cdot\right)$ assigns to each event
$\mathcal{A} \in \Sigma$ a number $\mathbb{P}\left(\mathcal{A}\right) \in [0,1]$ such that $\mathbb{P}\left(\Omega\right) = 1$
and the probability of a countable union of pairwise disjoint events is the sum of their probabilities.
The triple $(\Omega,\, \Sigma,\, \mathbb{P})$ is a probabilistic model of the process, not a property of it. There are principled methods for choosing
a useful probabilistic model $(\Omega,\, \Sigma,\, \mathbb{P})$ based on the observed data.
Rolling a die is a random experiment small enough to write the triple
out. Its sample space is $\Omega = \{1, \ldots, 6\}$. Its
$\sigma$-algebra $\Sigma$ is the collection of all subsets of
$\Omega$: that the roll is even is the event $\mathcal{A} = \{2,4,6\}$.
The uniform probability measure, $\mathbb{P}\left(\mathcal{A}\right) = |\mathcal{A}| / 6$, is the
model of a fair die, under which $\mathbb{P}\left(\{2,4,6\}\right) = 1/2$. Whether a given
die is fair is a question about the process rather than about the model,
answered by the relative frequencies of its outcomes in many rolls.
The observed data are measurements of the outcome of the experiment. In particular, each measurement is a
measurable function $x : \Omega \to \mathcal{X}$ of the outcome. Such a measurable
function is a random variable (RV), and the value $x(\omega)$ it takes for the actual outcome $\omega$ is a realization
of it (Billingsley, 1986; Gray, 2009). The temperature at 13:00 is an RV on the weather of a day,
and the number read on one day is a realization.
B-repeatThe probability measure on $\Omega$ induces the probability distribution of the RV, $\mathbb{P}^{(x)}(\mathcal{B}) = \mathbb{P}\left(x \in
\mathcal{B}\right)$ for every measurable set $\mathcal{B} \subseteq \mathcal{X}$ (Billingsley, 1986, Sect. 20).
Fig. 2 shows the process beside its mathematical representation: the experiment,
its outcome and the measured value above, the probability space and the RV that represent them below.
Figure 2: A random experiment and its mathematical representation.
The upper row is the process, the lower row the model, as the
labels at the left mark. Boxed items are objects, the
experiment, the probability space and the RV; unboxed items
are the values they produce. Solid arrows stay within one row;
the dashed arrows cross from the process to its model. The
process produces an outcome $\outcome$; a measurement of
that outcome is a measurable function
$\feature$ on $\samplespace$, an RV, and the value
$\feature(\outcome)$ it takes is a realization. The
probability distribution $\distof{\feature}$ of $\feature$ is
induced by $\prob{\cdot}$
Repeating a random experiment $(\Omega,\, \Sigma,\, \mathbb{P})$ a fixed number $m$ of times, under identical conditions,
defines a new random experiment $(\Omega,\, \Sigma,\, \mathbb{P})^{(m)}$ whose outcomes are sequences
$(\omega^{(1)}, \ldots, \omega^{(m)})$ of outcomes of the original one (Fig. 3).
Its sample space is the product $\Omega^{(m)} = \Omega \times \cdots \times \Omega$,
and its probability measure is the product $\mathbb{P}^{(m)} = \mathbb{P} \times \cdots \times \mathbb{P}$.
The measurements $x^{(1)}, \ldots, x^{(m)}$ of the runs are then independent and identically distributed (i.i.d.)RVs (Billingsley, 1986, Sect. 20).
In machine learning (ML) these measurements are the data points ${\mathbf z}^{(1)}, \ldots, {\mathbf z}^{(m)}$ of a training set.
While the outcome of a single experiment is uncertain, the long-run behavior of repeated experiments becomes
predictable: the law of large numbers and the central limit theorem (CLT) make this precise (Bertsekas and Tsitsiklis, 2008, Sects. 5.2 and 5.4).
Figure 3: Repeating a random experiment $\probspace$ a fixed number $\samplesize$ of times yields another random experiment $\probspacerep{\samplesize}$
whose outcomes are sequences $(\outcome^{(1)}, \,\outcome^{(2)}, \,\dots, \,\outcome^{(\samplesize)}) \in \samplespace\times\ldots\times \samplespace$.
One random experiment arising in many ML applications is the gathering of a training set $\datapoint^{(1)},\,\ldots,\,\datapoint^{(\samplesize)}$, whose
data points are RVs on the repeated runs. Boxes and arrows follow Fig. 2
The notion of a repeated experiment is an idealization that might result in a poor probabilistic model for a
physical or computational data-generating process. Successive rolls of a die can typically be considered a repeated
experiment. In contrast, the daily weather observations shown in Fig. 1
are not well represented as the result of a repeated experiment: a
warm day tends to follow a warm day, so the daily readings are
related rather than independent. The autocorrelation of such
a record measures that relation
(Brockwell and Davis, 1991, Sect. 1.5; Hyndman and Athanasopoulos, 2021).
B-mlRandom experiments arise in ML in three places: