One loop, walked with your own hands: see a distribution, draw samples from it,
fit the distribution back from the samples, then sample from the fit.
Density, samples, and fit true pdf data histogram fitted pdf
n:
Pick a family, then Draw samples.
The histogram is density-normalized, so as n grows it hugs the pdf.
Fits use maximum likelihood where it has a closed form (Normal, Uniform) and the
method of moments for Gamma and Beta — labeled in the readout.
The trap to try. Choose the mixture, draw 3000 samples,
and press Fit: the fit is a single Normal (the best one, by maximum likelihood) —
and it puts its peak exactly where the data is emptiest. The family you fit matters as much
as the fitting. How to measure how wrong this fit is — that is KL divergence,
next lecture.