Home/Learn/Math for AI/Descriptive Statistics: Mean, Variance & Std

Descriptive Statistics: Mean, Variance & Std

Beginner
Probability & Statistics

Mean, variance, and standard deviation summarise a dataset's center and spread — the first thing you compute about any data and the basis of normalization that makes models train well.

Overview

Before modelling anything, you describe it. The mean is the center of mass of your data; the median is the middle value (robust to outliers); the variance measures how spread out the values are (average squared distance from the mean); and the standard deviation is the square root of variance, back in the original units. These are not just summary trivia — they drive real ML practice. Feature normalization (subtract the mean, divide by the std) rescales every feature to a comparable range so gradient descent converges faster and no single large-scale feature dominates. Understanding spread also underlies detecting outliers, comparing distributions, and reasoning about model confidence. When a data scientist "looks at the data first", these numbers are what they look at.

Center and spread in one glance

Mean and median describe the center; variance and std describe spread. Note how the median resists an outlier that drags the mean.

Mean is sensitive to outliers; median is robust
import numpy as np

data = np.array([10, 12, 11, 13, 12, 100])   # one outlier (100)

print("mean  ", np.mean(data))     # 26.33 -> pulled up by the outlier
print("median", np.median(data))   # 12.0  -> robust to it
print("var   ", round(np.var(data), 1))
print("std   ", round(np.std(data), 1))

Standardization: the everyday use in ML

Z-score normalization rescales a feature to mean 0 and std 1. This is one of the highest-leverage preprocessing steps — it puts features on equal footing and speeds up training.

Z-score: (x − mean) / std → mean 0, std 1
import numpy as np

feature = np.array([50.0, 60.0, 70.0, 80.0, 90.0])
z = (feature - feature.mean()) / feature.std()   # standardize
print(np.round(z, 3))              # mean 0, std 1
print(round(z.mean(), 6), round(z.std(), 6))     # 0.0 1.0

Key Points to Remember

  • 1Mean = center of mass; median = middle value (robust to outliers)
  • 2Variance = average squared distance from the mean; std = its square root (same units)
  • 3Standardization (z-score) rescales features to mean 0, std 1
  • 4Normalized features help gradient descent converge and prevent scale dominance

Interview Questions

Sign in to ask Aria
1

When would you prefer the median over the mean?

EasyTCS
2

Why does feature standardization help gradient descent?

MediumAmazon
3

What is the difference between variance and standard deviation?

EasyInfosys

Ask Aria about Descriptive Statistics: Mean, Variance & Std

Your personal AI tutor — ask anything about this concept

Revision Status

Personal Notes

Sign in to save personal notes for this topic.

Discussion

Sign in to join the discussion.

Loading discussion…