AI Hints
Statistics & Math for ML · Lesson 7 of 138

The Mean

The balancing point.

⏱ 2 min read▶ Video at 6:53🎓 Free
Watch this lesson in the Statistics & Math for ML courseWatch on YouTube ↗Full Statistics & Math for ML course

If someone asks, what's a typical score, you'll probably give an average. There are three kinds of average, and the most common is the mean. Add everything up, and divide by how many there are.

The Mean
From the video: The Mean
  • What's typical?
  • Three kinds of average
  • The mean: add, then divide

Computing the mean

Here are our five exam scores again. The mean is the sum, divided by the count. NumPy has a mean function that does the same thing. Run it. Both give sixty seven point six.

mean.pypython
import numpy as np

scores = np.array([55, 72, 90, 40, 81])

print(scores.sum() / len(scores))
print(np.mean(scores))
Output
67.6
67.6

The balancing point

Imagine each score as a weight on a ruler. The mean is the point where the ruler balances perfectly. The distances below the mean exactly cancel the distances above it. That's why the mean is so useful in maths. But it also means one very heavy weight, far away, can drag the mean towards it.

keyvalue
Formulasum ÷ count
Symbolx̄ for a sample, μ for a population
Balancesdistances cancel out
Weaknesspulled by extremes

Summary

The mean is the sum divided by the count. It's the balancing point of the data. Next, the median, the middle value.

Key takeaways
  • sum / count
  • np.mean
  • The balancing point
Next up: The Median — the middle value