Syllabus Lesson 31 of 246 · Module 2: Maths and probability, only as needed
Module 2: Maths and probability, only as needed

The bell curve (Gaussians)

Why it matters Weights start as bell-curve noise, many measurements look like bell curves, and Part 2 of the course (Modules 15 to 18) builds a generator out of them.

A Gaussian, or normal distribution, is the bell curve. Two numbers describe it completely: its mean (where the peak sits) and its standard deviation (how wide it is). About 68% of samples land within one standard deviation of the mean, and about 95% within two.

Tiny numbers

Heights with mean 170 cm and standard deviation 10 cm: about 68% between 160 and 180, about 95% between 150 and 190. To make such samples from standard ones (mean 0, spread 1): multiply by 10, add 170.

Fitting a Gaussian to data: estimate its mean with the sample average and its spread with the sample standard deviation.

Recap Mean sets the centre, spread sets the width; 68 and 95 percent within one and two spreads.

Your turn

Write sample_gaussian(mean, std, n, seed) using default_rng(seed).standard_normal(n) scaled and shifted, and share_within(x, k): the fraction of samples within k standard deviations of their own mean.

Spotted a problem in this lesson? Report it · Ask about this lesson

This exercise opens soon

Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.