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. .
- 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, .
- Variance: the average squared distance from the mean. The distances are ; their squares add to , so the variance is . (Dividing by instead gives 24, the sample variance, used when the data is a sample from something bigger.)
- Standard deviation: the square root of the variance, , 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 , but the median stays at . 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?
The shortcut
Sort first, then guess and correct. Sorting gives the median, minimum, maximum, range and mode at a glance. For the mean, guess a round number, add up the deviations from it, and correct the guess by their average.
Guess
Guess 20.
Drills
Answer fast — trust the rule.
What is the median of the rents 14, 22, 26, 16, 22?
Flat F renting for 80 joins the five. What is the new mean?
Which measure of centre is barely moved by flat F?
What is the variance of the five rents, dividing by n?
Guessing 21 for the mean, the deviations sum to −5. What is the mean?
Remember
- Centre, spread, shape: report all three, and check the outliers.
- Shortcut: sort first; for the mean, guess and correct by the average deviation.
- Trap: quoting the mean of skewed data as "typical".
