Skip to the workspace
Pebellslearn by building
Statistics  ›  Lesson

Descriptive Statistics

Descriptive Statistics 14 minDescriptive statistics summarise a dataset by its centre, its spread and its shape, and outliers affect some summaries far more than others.

machine learning / Descriptive Statistics

Explore each scene at your own pace.

01 · The rule

The rule

Descriptive Statistics

Before training anything, an ML engineer looks at the data. A single summary line, "the average rent is 30", can hide the fact that most flats rent for much less and one penthouse drags the number up. Descriptive statistics are the few numbers that tell you what a column really looks like.

The rule

Centre, spread, shape: report all three, and check the outliers.

The five rents are 14, 22, 26, 16 and 22 thousand.

Centre, a typical value:

  • Mean: the sum divided by the count. 100/5=20100 / 5 = 20.
  • Median: the middle value once sorted. Sorted: 14, 16, 22, 22, 26, so the median is 22. With an even count, average the middle two.
  • Mode: the most frequent value, 22.

Spread, how far values stray:

  • Range: maximum minus minimum, 26−14=1226 - 14 = 12.
  • Variance: the average squared distance from the mean. The distances are −6,2,6,−4,2-6, 2, 6, -4, 2; their squares add to 36+4+36+16+4=9636 + 4 + 36 + 16 + 4 = 96, so the variance is 96/5=19.296 / 5 = 19.2. (Dividing by n−1=4n - 1 = 4 instead gives 24, the sample variance, used when the data is a sample from something bigger.)
  • Standard deviation: the square root of the variance, 19.2≈4.38\sqrt{19.2} \approx 4.38, back in thousands of rupees.
  • Quartiles split the sorted data into four equal parts; the gap between the first and third is the interquartile range.

Shape: is the data symmetric, or does a long tail stretch one way?

Now add flat F, a penthouse at 80. The mean jumps to 180/6=30180 / 6 = 30, but the median stays at (22+22)/2=22(22 + 22) / 2 = 22. The median is robust: one extreme value barely moves it. The mean, range and variance are all pulled hard by F. Before training, outliers like F should be investigated: a real penthouse, or someone typing 8 as 80?

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.