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

Your First Summary

Count, sum, min, max.

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

When you meet a new column of numbers, start with the simplest questions. How many are there? What's the smallest, and the largest? What's the total? These take seconds, and they often catch mistakes.

Your First Summary
From the video: Your First Summary
  • How many?
  • Smallest and largest?
  • The total?

Four quick numbers

Here are a week of coffee sales. Len counts them. Sum adds them up. Min and max give the smallest and largest. Run it. A sale of minus twenty? That can't be right. It's probably a refund, or a typing mistake.

summary.pypython
import numpy as np

sales = np.array([120, 135, 128, -20, 150, 170, 160])

print("count:", len(sales))
print("total:", sales.sum())
print("min:", sales.min(), " max:", sales.max())
Output
count: 7
total: 843
min: -20  max: 170

Always check first

Before any statistics, or any model, look at these simple numbers. Negative prices, ages of two hundred, or dates in the future are all signs of bad data. Cleaning them first saves you from wrong answers later. Garbage in, garbage out.

keyvalue
counthow many rows
sumthe total
min, maxthe extremes
Rulegarbage in, garbage out

Summary

Count, sum, min, and max are your first look at any column, and they catch bad data fast. Next, averages, starting with the mean.

Key takeaways
  • len, sum
  • min, max
  • Check for bad values
Next up: The Mean — the balancing point