Home / Maths for AI / Symbols / Probability and statistics

Variance

Say it: "the variance of X"

What it means

The expected squared distance from the mean: Var(X)=E[(X−μ)2]=σ2\mathrm{Var}(X) = \mathbb{E}[(X - \mu)^2] = \sigma^2.

Example

Var(2,4,4,4,5,5,7,9)=4\mathrm{Var}(2, 4, 4, 4, 5, 5, 7, 9) = 4

So the standard deviation is 2.

In code

import numpy as np
print(np.var([2, 4, 4, 4, 5, 5, 7, 9]))

Output

4.0

Where it appears in machine learning

The bias-variance trade-off, weight initialisation scales, and the spread of predictions.

Related symbols

Learn it properly in the free lesson Describing Data, with practice questions that check your answers.