Variance
The average squared distance of a random variable from its own mean — how widely values scatter.
Variance is : take each value's distance from the mean, square it, average the squares. Squaring stops positive and negative deviations cancelling and makes far-away points count much more than near ones, which is why variance is sensitive to outliers.
Two mistakes are worth knowing about because both are silent. There are two variances — dividing by gives the population version, dividing by gives the sample version, and NumPy defaults to while pandas defaults to . At eight data points the two differ by about 14%, which matters exactly when you are comparing models across a handful of cross-validation folds.
And never compute it as . With large means those two terms agree in their leading digits and the subtraction destroys all precision, frequently returning a negative variance — which is impossible for an average of squares. A negative variance always means this.