Distributions and Maximum Likelihood
W02 · Part 1 — see it, sample it, fit it, sample from the fit
Uma Satyaranjan · Soma S Dhavala
Invalid Date
Where we are
- W01: a generative model produces samples — and we saw a complete one on two data points
- The loop of this module: distribution → samples → fitted distribution → new samples
- Today we make the word fit precise: maximum likelihood
Tomorrow: KL divergence (how wrong is a fit?). Then: empirical risk minimization.
The cast of distributions
|
|
endpoints |
total ignorance on an interval |
|
|
center, width |
noise, sums of small effects |
|
|
shape, scale |
waiting times, positive skew |
|
|
two shapes |
proportions, probabilities |
| Mixture |
|
weights + components |
multimodal data — clusters |
Five shapes cover most of what this course needs — and the mixture is the star of the semester.
Playground: see it, sample it, fit it
What the histogram is telling you
- Density-normalized histogram → as grows it hugs the pdf: samples carry the distribution
- is ragged, is faithful — estimation error shrinks like (Module 1 will say this properly)
- Fitting = choosing the family member that makes the observed samples most probable
PDF vs likelihood — the confusion, dissolved
One function, two readings
| parameters |
data |
pdf — a distribution over data |
, always |
| observed data |
parameters |
likelihood — a score for fitting |
meaningless |
The likelihood is not a probability distribution over . Only its argmax — and its shape near the argmax — carries information.
Likelihood of a dataset
Independent observations multiply; logs turn products into sums:
- The log changes nothing about where the maximum is (log is monotone)
- …and everything about how pleasant the algebra is
- Numerically: products of 3000 small numbers underflow; sums of logs do not
To the board: the Gaussian MLE
Maximize
- (the sample mean — for every )
Derivation on the board now — it is tonight’s Exercise if you want to redo it alone. Note the divisor , not : the MLE is (slightly) biased.
Honesty about the other families
| Normal |
maximum likelihood |
closed form — you just derived it |
| Uniform |
maximum likelihood |
closed form: , (cute proof — exercise) |
| Gamma |
method of moments |
MLE has no closed form: match and instead |
| Beta |
method of moments |
same story |
| Mixture |
…? |
stay tuned — this one needs real machinery (EM, later) |
Method of moments: set the family’s mean and variance equal to the sample’s. Simple, honest, and a good estimator to know by itself.
The trap: right method, wrong family
- In the playground: mixture data, 3000 samples, press Fit
- The single best Normal — by maximum likelihood, done perfectly — puts its peak where the data is emptiest
- Fitting well within the wrong family is still wrong
Needed: a way to measure the gap between the data distribution and the model. That measure is KL divergence — tomorrow.
The pdf and the likelihood are the same curve — you just walk along it in different directions.
Tonight: derive , prove Uniform’s MLE is (min, max), and play the mixture trap yourself.