Maximum Likelihood and Its Obstacle
Chapters 9 and 10 both ended in a formula. This one does not, and the book says so before it starts:
Our “normal” procedure would be to compute the gradient of the log-likelihood with respect to the model parameters , set it to , and solve for . However […] we cannot obtain a closed-form solution.
This page is about exactly what that sentence costs, measured on the book’s own seven data points.
What you’ll learn
Section titled “What you’ll learn”- The book’s running example, reproduced: with initialised at , , — negative log-likelihood , which is the the book prints.
- Equations 11.9–11.10, and why the log form is not cosmetic: the product underflows to exactly by about .
- Equation 11.11: with the log gets inside and there is a closed form — checked against a numerical optimiser to .
- Equations 11.12–11.16, and the precise sense in which Equation 11.20 is not a solution: put in, get a different out — measured, by on the first round.
- The analytic gradient of Equation 11.22c, checked against central differences to .
- The likelihood surface has many summits. restarts on seven points find distinct values — and of them () collapse a component onto a data point.
- §11.5’s singularity, measured: pin a mean to a data point and shrink its variance, and the log-likelihood climbs without bound — at against the book’s converged .
- A finding the book does not mention: its own initialisation reaches , while a different basin reaches — a genuinely better non-degenerate fit, by nats.
Intuition: the log cannot get past the sum
Section titled “Intuition: the log cannot get past the sum”Every closed form in Chapters 9 and 10 came from the same accident. The log-likelihood of a Gaussian is a quadratic in the parameters, so setting its derivative to zero gives a linear system, and a linear system you can solve.
Take a mixture and that collapses. Equation 11.10 is , and the outer log cannot be moved inside the inner sum. Differentiate it and every term carries a factor — the whole mixture density — so the equation for mentions every other parameter. You get a condition the answer satisfies, not the answer.
flowchart TD A["log p(X | theta) = sum_n log sum_k pi_k N(...)
Equation 11.10"] A -->|"K = 1: the sum vanishes"| B["log N is a quadratic
Equation 11.11"] B --> C["set the derivative to 0
-> the sample mean and variance"] A -->|"K > 1: the log is stuck outside"| D["every derivative carries 1/p(x_n | theta)
Equations 11.15, 11.16"] D --> E["r_nk appears
Equation 11.17"] E --> F["mu_k = sum r x / sum r
but r depends on mu"] F --> G["iterate: Section 11.3"]
§11.2 The likelihood
Section titled “§11.2 The likelihood”For an i.i.d. dataset :
On the book’s seven points at its initialisation:
| value | |
|---|---|
| the product, Equation 11.9 | |
| its logarithm | |
| the sum of logs, Equation 11.10 | (gap ) |
| the negative log-likelihood | — the book’s |
The necessary conditions, and what they are not
Section titled “The necessary conditions, and what they are not”Setting the three gradients to zero (Equations 11.12–11.14) requires, by the chain rule,
That denominator is the whole mixture. Every parameter’s equation now mentions every other parameter — which is precisely where the responsibilities of page 1103 come from, and precisely why Equation 11.20 is a fixed-point condition:
The gradient itself is exactly what the book derives. Equation 11.22c gives , and against central differences on the initialisation:
| analytic, Equation 11.22c | |||
| central differences |
Largest relative gap: . The derivation is right; it just does not solve anything.
The surface, and what is on it
Section titled “The surface, and what is on it”Run the iteration from random starting points on the same seven numbers:
| count | share | |
|---|---|---|
| distinct final log-likelihoods | ||
| runs where a component collapsed () | ||
| genuine fits | ||
| distinct non-degenerate optima |
-
Why does Equation 11.10 use a sum of logarithms rather than the product of Equation 11.9?
The numerical benefit survives any K. The analytic one does not: at K = 1 the log lands directly on the Gaussian and gives a closed form, and at K greater than 1 it is stuck outside a sum. That asymmetry is what the rest of the chapter is about.
pch.quizShowAnswer
B — For two reasons: the product underflows to exactly 0.0 by about N = 185, and the log usually simplifies the algebra — The numerical benefit survives any K. The analytic one does not: at K = 1 the log lands directly on the Gaussian and gives a closed form, and at K greater than 1 it is stuck outside a sum. That asymmetry is what the rest of the chapter is about.
-
In what sense is Equation 11.20 not a solution for the means?
The chain rule brings 1 over the whole mixture density into every derivative, so each parameter's equation mentions every other parameter. The result is a fixed-point condition. Plotted against its input it is an S-shaped curve crossing the diagonal, where a formula would be a flat line.
pch.quizShowAnswer
B — Its right-hand side depends on the means through the responsibilities, so feeding the answer back in changes it — measured, by 4.295713 on the first round — The chain rule brings 1 over the whole mixture density into every derivative, so each parameter's equation mentions every other parameter. The result is a fixed-point condition. Plotted against its input it is an S-shaped curve crossing the diagonal, where a formula would be a flat line.
-
400 random restarts on seven data points produced how many distinct final log-likelihoods?
54.5 percent of runs collapsed a component, and those report higher likelihoods than any genuine fit — up to plus 5.5802 against minus 13.9062. Among the 182 honest runs there are exactly two optima, and the book's initialisation reaches the worse one by 0.067161 nats.
pch.quizShowAnswer
B — Seventeen, of which 218 runs had collapsed a component onto a data point — 54.5 percent of runs collapsed a component, and those report higher likelihoods than any genuine fit — up to plus 5.5802 against minus 13.9062. Among the 182 honest runs there are exactly two optima, and the book's initialisation reaches the worse one by 0.067161 nats.
-
What happens to the likelihood if a component's mean sits exactly on a data point and its variance shrinks?
Section 11.5 names this. Because the likelihood is unbounded above, the maximum likelihood estimate for a GMM with free covariances does not exist, and every algorithm in the chapter is finding a local optimum. The tallest points on the surface are not models.
pch.quizShowAnswer
B — It grows without bound — measured at plus 16.377668 for a variance of 1e-30 — Section 11.5 names this. Because the likelihood is unbounded above, the maximum likelihood estimate for a GMM with free covariances does not exist, and every algorithm in the chapter is finding a local optimum. The tallest points on the surface are not models.
Exercises
Section titled “Exercises”Exercise 1 – Reproduce the book’s 28.3
Section titled “Exercise 1 – Reproduce the book’s 28.3”Exercise 2 – Watch the product die
Section titled “Exercise 2 – Watch the product die”Exercise 3 – Where the closed form still exists
Section titled “Exercise 3 – Where the closed form still exists”Exercise 4 – Put the answer in, get a different answer out
Section titled “Exercise 4 – Put the answer in, get a different answer out”Exercise 5 – Climb the singularity
Section titled “Exercise 5 – Climb the singularity”Recall card
Section titled “Recall card”- The book’s running example is seven numbers, three components initialised deliberately badly, and a negative log-likelihood of 28.325536 — the 28.3 it prints.
- Equation 11.10 takes the log for two reasons, and only one of them survives K greater than one.
- Numerically: the product of Equation 11.9 underflows to exactly zero by about two hundred data points, and its logarithm becomes minus infinity.
- Analytically: at K equal to one the log lands directly on the Gaussian, Equation 11.11, and the answer is the sample mean and sample variance — confirmed by an optimiser to 6e-08.
- At K greater than one the log is stuck outside a sum, so the chain rule drags one over the whole mixture density into every derivative.
- Which means every parameter’s equation mentions every other parameter. Equation 11.20 is a condition the answer satisfies, not the answer.
- Measured, feeding the means back in moves them by 4.295713 on the first round, then 0.130775, then 0.018414. A formula would move them by zero.
- The analytic gradient is right — it matches central differences to 3e-10 — it simply cannot be solved.
- Four hundred restarts on seven points find seventeen distinct optima.
- Two hundred and eighteen of them, 54.5 percent, collapse a component onto a data point, and every one of those reports a higher likelihood than every genuine fit.
- The likelihood is unbounded above: pin a mean to a data point and shrink its variance and the log-likelihood reaches plus 16.377668 at 1e-30. So the maximum likelihood estimate does not exist.
- Among the honest fits there are exactly two optima, and the book’s own initialisation reaches the worse one — minus 13.973323 against an available minus 13.906162.
Next: Responsibilities — §11.2.1, the quantity that appeared in every derivative above, and what it means.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading