The Gaussian Mixture Model
Chapter 9 fitted a function. Chapter 10 found a subspace. Chapter 11 fits a density — the third pillar — and it starts from an admission:
In practice, the Gaussian (or similarly all other distributions we encountered so far) have limited modeling capabilities.
The fix is one line of algebra. The consequences take a chapter, and the chapter warns you at the outset: “unlike other applications we discussed earlier (linear regression or PCA), we will not find a closed-form maximum likelihood solution.”
What you’ll learn
Section titled “What you’ll learn”- Equations 11.1–11.4: what a mixture model is, and why both halves of Equation 11.2 are needed — measured, dropping either one breaks the density in a different way.
- Equation 11.5, the book’s own three-component mixture, checked: it integrates to .
- The mean of a mixture is a weighted mean; the variance is not a weighted variance. Measured on Equation 11.5: , of which the component variances supply and the spread of the means supplies — of the total.
- How far a mixture is from any single Gaussian: skewness , excess kurtosis , and nats of KL from the closest one.
- components do not mean modes. Two equal unit-variance Gaussians show one bump until their means are more than apart — the transition measured at .
- recovers a single Gaussian exactly, to .
- What the extra flexibility is worth: nats per data point on Figure 11.1’s kind of data, for parameters against .
Intuition: averaging densities, not averaging data
Section titled “Intuition: averaging densities, not averaging data”There is a move here that is easy to read past. A mixture does not average the random variables — it averages the densities. Those are different operations and they give different answers.
Average two Gaussian random variables and you get a Gaussian, narrower than either. Average their densities and you get something that is not Gaussian at all, and wider than either — because the disagreement between the components is itself a form of spread.
That one distinction is the whole of §11.1, and the measurement below puts a number on it: of Equation 11.5’s variance comes from the components disagreeing about where the data is, not from any component’s own width.
flowchart TD G["one Gaussian
D + D(D+1)/2 parameters"] -->|"convex combination
Equations 11.1, 11.2"| M["a mixture
K times that, plus K-1"] M --> A["multimodal: Figure 11.1"] M --> B["skewed, heavy- or light-tailed"] M --> C["log p has a sum inside it
Equation 11.10"] C --> D["no closed-form maximum likelihood
which is Sections 11.2 and 11.3"]
§11.1 The definition
Section titled “§11.1 The definition”A mixture model describes as a convex combination of base distributions:
With Gaussian components, this is the Gaussian mixture model:
with . The book’s worked instance:
The mean behaves. The variance does not.
Section titled “The mean behaves. The variance does not.”For a mixture, — the operation you would guess. The variance is not . By the law of total variance, conditioning on which component was used:
On Equation 11.5, by numerical quadrature against the closed form:
| quantity | value |
|---|---|
| by quadrature | |
| by quadrature | |
| within-component part, | |
| between-component part | |
| their sum | (gap ) |
K components, and somewhere between 1 and K bumps
Section titled “K components, and somewhere between 1 and K bumps”The book motivates mixtures by “multimodal data representations, i.e., they can describe datasets with multiple ‘clusters’”. True — but the count does not transfer. Two equal-weight unit-variance Gaussians at :
| separation of the means | modes | |
|---|---|---|
Bisected, the transition sits at — the means must be more than exactly apart before a second bump appears at all. (The eighth decimal moves with the grid; the value itself is exactly .)
And it moves with the weights. The more lopsided the mixture, the further apart the means must be:
| at which the second mode appears | |
|---|---|
What the flexibility buys, and what it costs
Section titled “What the flexibility buys, and what it costs”On points drawn from a three-component mixture in — Figure 11.1’s kind of data:
| model | parameters | log-likelihood |
|---|---|---|
| one fitted Gaussian | ||
| the true mixture | ||
| difference | nats, or per point |
nats per point is a factor of in likelihood, per observation. That is the case for the chapter. And the price is stated in the same paragraph that makes the case:
The logarithm cannot get inside the sum. For it can — Equation 11.11 — and that is exactly why Chapters 9 and 10 had closed forms and this chapter does not. Page 1102 measures what that costs.
-
Equation 11.2 asks for weights in [0, 1] that sum to 1. Why not just the sum?
Using weights [0.8, -0.1, 0.3] the result still integrates to exactly 1.000000 and is still not a density. Summing to one buys normalisation; non-negativity buys the rest. A convex combination is required, not an affine one.
pch.quizShowAnswer
B — Because a weight vector can sum to 1 and still produce a function that goes negative — measured at -2.7e-02 — Using weights [0.8, -0.1, 0.3] the result still integrates to exactly 1.000000 and is still not a density. Summing to one buys normalisation; non-negativity buys the rest. A convex combination is required, not an affine one.
-
How does a mixture's variance relate to its components' variances?
Measured on Equation 11.5: the total is 7.79, the weighted component variances supply 0.95 and the spread of the means supplies 6.84 — 87.80 percent of the total. Averaging the component variances would understate the spread by that much. The mean, by contrast, really is the weighted mean.
pch.quizShowAnswer
B — It is that, plus the weighted spread of the component means about the overall mean — Measured on Equation 11.5: the total is 7.79, the weighted component variances supply 0.95 and the spread of the means supplies 6.84 — 87.80 percent of the total. Averaging the component variances would understate the spread by that much. The mean, by contrast, really is the weighted mean.
-
A GMM has K = 5 components. How many modes does its density have?
Measured by bisection, the transition for two equal-weight unit-variance Gaussians is at d = 1.0000000, i.e. means exactly two standard deviations apart. Unequal weights push it further: at a weight of 0.9 the threshold is 1.657251. Counting bumps in a histogram is a lower bound on K, never an estimate of it.
pch.quizShowAnswer
B — Anywhere from 1 to 5 — two equal unit-variance components show one bump until their means are more than 2 sigma apart — Measured by bisection, the transition for two equal-weight unit-variance Gaussians is at d = 1.0000000, i.e. means exactly two standard deviations apart. Unequal weights push it further: at a weight of 0.9 the threshold is 1.657251. Counting bumps in a histogram is a lower bound on K, never an estimate of it.
-
Why does Equation 11.10 not admit a closed-form maximum likelihood solution?
For K = 1 the sum vanishes and the log applies directly to the Gaussian — Equation 11.11 — which is what gave Chapters 9 and 10 their closed forms. With K greater than 1 the log of a sum has no such simplification, and Sections 11.2 and 11.3 are the consequence.
pch.quizShowAnswer
B — Because the logarithm sits outside a sum over components and cannot be moved inside it — For K = 1 the sum vanishes and the log applies directly to the Gaussian — Equation 11.11 — which is what gave Chapters 9 and 10 their closed forms. With K greater than 1 the log of a sum has no such simplification, and Sections 11.2 and 11.3 are the consequence.
Exercises
Section titled “Exercises”Exercise 1 – Break Equation 11.2, two ways
Section titled “Exercise 1 – Break Equation 11.2, two ways”Exercise 2 – The law of total variance, on Equation 11.5
Section titled “Exercise 2 – The law of total variance, on Equation 11.5”Exercise 3 – How far from Gaussian?
Section titled “Exercise 3 – How far from Gaussian?”Exercise 4 – Find the threshold where the second bump appears
Section titled “Exercise 4 – Find the threshold where the second bump appears”Exercise 5 – What the extra parameters are worth
Section titled “Exercise 5 – What the extra parameters are worth”Recall card
Section titled “Recall card”- Chapter 11 estimates a density, the third of the book’s pillars, and starts by admitting that a single Gaussian is often a poor model.
- A mixture is a convex combination of simple densities, and both halves of Equation 11.2 are needed: weights that sum to one but go negative still integrate to one and are still not a density.
- The mean of a mixture is the weighted mean of the component means. The variance is not the weighted average of the component variances.
- On the book’s own Equation 11.5 the total variance is 7.79, of which the component widths supply 0.95 and the spread of the means supplies 6.84 — 87.80 percent.
- That decomposition is the law of total variance, and it comes back in Section 11.2 when a component’s width shrinks as its mean moves.
- A mixture is not a Gaussian: measured skewness 0.427185 and excess kurtosis minus 1.294278, both exactly zero for any Gaussian.
- The closest single Gaussian is still 0.330585 nats away in KL, and puts its peak where the mixture has a trough.
- K components give between one and K modes. Two equal unit-variance Gaussians show one bump until their means are more than two standard deviations apart.
- Measured by bisection, that transition is at d = 1.0000000, and unequal weights push it out to 1.657251 at a weight of nine tenths.
- So counting bumps in a histogram is a lower bound on K and never an estimate of it.
- The flexibility is worth 1.388610 nats per data point on the kind of data Figure 11.1 shows — a factor of four in likelihood — for twelve extra parameters.
- And it costs the closed form. In Equation 11.10 the logarithm sits outside a sum over components and cannot be moved inside, which is the whole reason Sections 11.2 and 11.3 exist.
Next: Maximum Likelihood and Its Obstacle — §11.2’s opening, and exactly what the log-of-a-sum costs.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading