A Random Variable is a numerical function that assigns a value to each outcome of a random experiment. Formally, it maps the sample space $\Omega$ to the real numbers. Random variables are discrete if they take countably many values (e.g., number of heads in ten coin flips) or continuous if they take values in an interval (e.g., tomorrow's temperature). A discrete random variable is described by its probability mass function (PMF) $p(x) = P(X = x)$; a continuous one by its probability density function (PDF) $f(x)$.
Random variables bridge the gap between abstract probability theory and the numerical quantities that algorithms manipulate. In machine learning, feature vectors, labels, model parameters, loss values, and predictions are all modelled as random variables or functions of them. The assumption that training examples are drawn independently and identically distributed (i.i.d.) from some underlying distribution is foundational to most of statistical learning theory.
The cumulative distribution function $F(x) = P(X \leq x)$ provides a unified description for both discrete and continuous random variables. Key summary statistics include the expectation $\mathbb{E}[X]$ (the mean or centre of mass), the variance $\text{Var}(X) = \mathbb{E}[(X - \mathbb{E}[X])^2]$ (a measure of spread), and the standard deviation $\sigma = \sqrt{\text{Var}(X)}$ (which shares units with $X$). Higher moments capture skewness and kurtosis.
Related terms: Probability Distribution, Expectation, Variance
Discussed in:
- Chapter 4: Probability — Probability Basics
Also defined in: Textbook of AI