The expected value (mean) of a random variable is its probability-weighted average: what you'd get on average over infinitely many draws. For a fair six-sided die, , a value the die can never actually show.
Expectation is linear: , always, even when and are dependent. The loss functions you'll minimise are expectations over the data distribution, approximated by averages over a training set.
Variance and standard deviation
The variance is the expected squared distance from the mean, and the standard deviation is its square root, back in the original units. Scaling a variable scales its variance by the square: .
How sure is an average?
Average independent samples and the variance of the average shrinks by a factor of , so its standard deviation, the standard error, shrinks by :
This matters every time you measure a model. A test accuracy of 90% measured on 100 examples has a standard error of about percentage points, so a rival model scoring 92% might not be better at all. To halve the uncertainty you need four times as much test data.
Covariance and correlation
Covariance measures whether two variables move together: positive if one tends to be above its mean when the other is. The correlation coefficient rescales covariance to lie between −1 and 1:
- Correlation only measures linear relationships. with symmetric around 0 has correlation 0, yet is completely determined by .
- Correlation is not causation. Ice-cream sales and drowning deaths are correlated because both rise in summer. A model trained on correlations will happily use such confounded features, and it will break when the hidden cause changes.
- Correlation is the cosine similarity of the two centred data vectors: the dot product again.
Averages get more reliable with , not . Before celebrating a 1% improvement, ask how big the test set was.