Random Variable

A random variable maps uncertain outcomes to values. In machine learning, inputs, labels, predictions, latent variables, noise, and evaluation scores can all be treated as random variables.

Formally, a random variable is a function:

where is the sample space and is the value space.

Distribution

The distribution of describes how likely each value is:

for a set of possible values .

For a discrete variable:

For a continuous variable:

where is a probability mass or density function depending on the variable type.

Multiple Random Variables

Machine learning usually studies pairs or tuples:

where may be an input and a label. A model often estimates:

Latent-variable models introduce unobserved variables:

where is not directly observed.

Functions of Random Variables

If , then is also a random variable. Losses and metrics are often functions of random variables:

Before averaging, the loss itself has a distribution. This is why confidence intervals and bootstrap estimates matter.

Observed vs Unobserved

Observed dataset values are realizations:

The notation should not confuse the random variable with a particular observed sample .

Why It Matters

  • A dataset is a finite sample from random variables .
  • A model output can estimate .
  • A loss is often a random variable before it is averaged.
  • Metrics estimate expected behavior from finite samples.

Checks

  • What is random: input, label, noise, model output, split, or metric?
  • What distribution is assumed: training, validation, test, deployment, or model distribution?
  • Is the variable discrete, continuous, vector-valued, graph-valued, or structured?
  • Is the observed dataset one sample, or a distribution itself?
  • Are labels, predictions, losses, and metrics treated as random variables before aggregation?
  • Is a latent variable assumed, observed, inferred, or only a modeling device?
  • Does the notation distinguish random variables from observed values?