Course contentsShow
← Machine Learning and Deep Learning
Lesson 63 of 3,5381. Mathematical Foundations for Machine LearningFree lesson

Variance and Standard Deviation

Measure spread of distributions using variance and its square root, standard deviation.

Variance and Standard Deviation

What You'll Learn

You'll learn how to measure how spread out data points are from the mean using variance and standard deviation.

Understanding Spread

Imagine you have two classes of students who both average a test score of 75. In Class A, most students scored between 70-80. In Class B, scores ranged wildly from 30 to 100. Both have the same mean, but they're very different! Variance and standard deviation capture this difference.

Variance: Measuring Spread

Variance tells you the average squared distance of each data point from the mean. Here's the intuition:

  1. Calculate the mean (expectation) of your data
  2. For each data point, find how far it is from the mean
  3. Square these distances (to make negatives positive and emphasize larger deviations)
  4. Take the average of all these squared distances

For a random variable X with mean μ:

Variance = E[(X - μ)²]

This means: "the expected value of the squared deviation from the mean."

Standard Deviation: Back to Original Units

There's one problem with variance: it's in squared units. If you're measuring heights in centimeters, variance is in cm². That's hard to interpret!

Standard deviation solves this by taking the square root of variance, bringing us back to the original units:

Standard Deviation = √Variance

Think of standard deviation as the "typical distance" a data point sits from the mean.

Why This Matters in ML

In machine learning, understanding variance helps you:

  • Detect outliers (points far from the mean)
  • Normalize features with different scales
  • Understand model uncertainty
  • Evaluate prediction consistency

Key Takeaway: Variance measures how spread out data is from the mean by averaging squared deviations; standard deviation is simply the square root of variance, giving you spread in the original units.