skipnothing/Math for Machine Learning
UNIT 03

Statistics & Distributions

Variance, bell curves, and the shapes data takes

Data has shape. Understanding that shape, its center, spread, and distribution, is the foundation of everything statistical in ML.

Loading…
BUILDS ON
TOPICS
#11

Mean, Median, Mode

Pick mean, median, or mode by the shape of the data, predict which one an outlier drags and which one holds, and read the mean-median gap as a numerical measure of skew.

Six salaries, `[52, 55, 58, 60, 64, 240]`, and two honest people report the typical pay as $88k and $59k. Both did the arithmetic right; the number you trust depends on which question you asked.

14 min
#12

Variance & Standard Deviation

Square each value's gap from the mean into the variance, square-root it back to a standard deviation in the data's own units, then rescale any value to a mean-zero, standard-deviation-one z-score for feature preprocessing.

Two classes both average 75 on one test, `[73, 74, 75, 76, 77]` and `[55, 65, 75, 85, 95]`. By that average they look identical, yet one class is ten times more spread out than the other.

14 min
#13

Normal Distribution

Pin a bell curve down with just two numbers, a center and a width, apply the 68-95-99.7 rule to turn any standard-deviation band into a percentage of the data, and read a value's percentile by standardizing it onto the single standard normal, then catch where skewed data breaks the rule.

Line up the heights of a thousand adult men and they pile into a smooth hump: most crowd near `69` inches, thinning fast toward the very tall and the very short. Two numbers describe that whole pile.

14 min
#14

Binomial Distribution

Tally the successes in `n` independent yes/no trials at a constant rate `p`, read the center `np` and spread `√(np(1-p))` straight from those two numbers, and swap in the normal approximation once `np` and `n(1-p)` both clear `10`.

Blast a signup offer to 200 inboxes, each person clicking or ignoring at the same 3% rate. You will rarely get exactly 6 clicks twice: the count wanders, and its entire spread rides on just two numbers.

14 min
#15

Correlation vs Causation

Average two columns' standardized products into a single number in `[−1, +1]`, test it against Anscombe's quartet to see what one summary hides, then separate cause from reverse cause, a confounder, and coincidence by assigning the treatment at random.

A spreadsheet column of hours slept and a column of exam scores drift up together, and `corr()` hands you one number for the whole pattern, but that number stays silent about which one moved the other.

14 min
#16

Covariance & Correlation Matrices

Pair two columns' deviations into a covariance, stack every pair into one symmetric matrix built in one line as centered data times its own transpose over n − 1, then read the diagonal as each column's spread and the off-diagonal as the cloud's tilt, and divide out the units for the correlation matrix.

Line up two columns of a health survey, height and weight; variance scores them one at a time, but pair their gaps and a single `np.cov(data)` call folds the whole spreadsheet's spread and tilt into one grid of numbers.

16 min
UNLOCKS
All units