Simple Algorithm
Machine Learning · Convergence · 28 min

Gaussian Mixture Models in Depth

Identifiability, singularities and choosing the number of components.

The Gaussian mixture is the simplest latent-variable model, and it still breaks almost every rule of textbook statistics. Its likelihood has no maximum, its parameters are identified only up to relabeling, the number of components escapes the usual tests, and EM provably gets stuck. This lesson takes each failure in turn and says what is known about it.

What you’ll learn

  • Prove that the Gaussian mixture likelihood is unbounded, and compare the remedies: constraints, variance floors, priors and local maximizers.
  • State the identifiability theorem for finite Gaussian mixtures, prove the univariate case from tail asymptotics, and explain label switching and the slow n−1/4n^{-1/4} rate of overfitted mixtures.
  • Choose the number of components with BIC, ICL or held-out likelihood, and explain why likelihood-ratio and Laplace asymptotics fail for mixtures.
  • Describe Dirichlet-process mixtures through the Chinese restaurant process, and what their posterior on the number of clusters does not estimate.
  • Summarize provable algorithms for learning mixtures and the landscape of EM: global convergence for two components, bad local maxima for three or more.

A likelihood with no maximum

DerivationProof: let one component collapse onto one point
  1. p(xi) ≥ 12 N(xi∣xˉ,S) ≥ c2for all ip(\mathbf x_i)\ \ge\ \tfrac12\,\mathcal N(\mathbf x_i\mid\bar{\mathbf x},S)\ \ge\ \tfrac c2\qquad\text{for all }i

    Take π1=π2=12\pi_1=\pi_2=\tfrac12 (any other components get weight 0, or a tiny weight), let component 2 be a fixed Gaussian N(xˉ,S)\mathcal N(\bar{\mathbf x},S) with SS positive definite, and let c=min⁡iN(xi∣xˉ,S)>0c=\min_i\mathcal N(\mathbf x_i\mid\bar{\mathbf x},S)>0. Component 2 alone keeps every point's density bounded below:

  2. p(x1) ≥ 12 (2πσ2)−d/2p(\mathbf x_1)\ \ge\ \tfrac12\,(2\pi\sigma^2)^{-d/2}

    Put component 1 exactly on the first point, μ1=x1\boldsymbol\mu_1=\mathbf x_1, with Σ1=σ2I\Sigma_1=\sigma^2I. At its own center a Gaussian density is (2πσ2)−d/2(2\pi\sigma^2)^{-d/2}:

  3. ℓ(θ) ≥ log⁡12−d2log⁡(2πσ2)+(n−1)log⁡c2 → σ→0  +∞\ell(\boldsymbol\theta)\ \ge\ \log\tfrac12-\tfrac d2\log(2\pi\sigma^2)+(n-1)\log\tfrac c2\ \xrightarrow{\ \sigma\to0\ }\ +\infty

    Add the logarithms and let σ→0\sigma\to0. The spike contributes −d2log⁡σ2→+∞-\tfrac d2\log\sigma^2\to+\infty while the other n−1n-1 terms stay above a fixed constant:

So "the" maximum-likelihood estimate does not exist: the supremum is approached only by degenerate spikes at single points. The useful estimator is a local maximizer in the interior, near the truth, which is what EM from a sensible start finds. To make the problem well posed, practitioners use one of these:

  • Constraints. Hathaway (1985) bounded the ratios of the component standard deviations away from zero in the univariate case; the constrained problem has a strongly consistent global solution. A covariance shared by all components cannot collapse onto one point without starving the other points, and keeps the likelihood bounded once there are enough points in general position.
  • Floors. Raise every eigenvalue of every Σk\Sigma_k to at least ε\varepsilon, or add εI\varepsilon I (scikit-learn's reg_covar); the widget does the former with ε=4⋅10−4\varepsilon=4\cdot10^{-4}.
  • Priors. A conjugate (normal–inverse-Wishart) prior turns the problem into MAP estimation, whose objective is bounded (Fraley & Raftery, 2007).
Predict before you look

In the plane (d=2d=2), a component sits exactly on one data point and dominates that point's density, while the other points are explained by other components. By how much does the log-likelihood increase each time this component's standard deviation is halved?

Show the answer

1.39

The density at the center is πk(2πσ2)−d/2\pi_k(2\pi\sigma^2)^{-d/2}, so halving σ\sigma multiplies it by 2d=42^d=4 and adds log⁡4≈1.39\log4\approx1.39 to the log-likelihood, every time, without end. In dd dimensions each halving adds dlog⁡2d\log2, so collapse is even more tempting in high dimension.

Identifiability and label switching

A model {pθ}\{p_{\boldsymbol\theta}\} is identifiable if pθ=pθ′p_{\boldsymbol\theta}=p_{\boldsymbol\theta'} implies θ=θ′\boldsymbol\theta=\boldsymbol\theta'. A mixture can never pass this test literally: permuting the KK components gives the same density, so every parameter vector has K!K! twins. The right question is whether the density determines the mixing distribution G=∑kπk δ(μk,Σk)G=\sum_k\pi_k\,\delta_{(\boldsymbol\mu_k,\Sigma_k)}, that is, the set of components and their weights.

DerivationProof of the univariate case: the heaviest tail gives itself away
  1. a1+∑j≥2aj φμj,σj(x)φμ1,σ1(x)=0for all xa_1+\sum_{j\ge2}a_j\,\frac{\varphi_{\mu_j,\sigma_j}(x)}{\varphi_{\mu_1,\sigma_1}(x)}=0\qquad\text{for all }x

    Subtract the two mixtures and merge equal components. Identifiability follows if Gaussian densities with distinct (μ,σ)(\mu,\sigma) are linearly independent: no relation ∑jajφμj,σj(x)=0\sum_ja_j\varphi_{\mu_j,\sigma_j}(x)=0 for all xx with every aj≠0a_j\ne0. Order the components by σ\sigma (largest first), breaking ties by μ\mu (largest first), and divide the relation by the first density:

  2. φμj,σj(x)φμ1,σ1(x) ⟶ 0(j≥2)\frac{\varphi_{\mu_j,\sigma_j}(x)}{\varphi_{\mu_1,\sigma_1}(x)}\ \longrightarrow\ 0\qquad(j\ge2)

    If σj<σ1\sigma_j<\sigma_1, the log of the ratio has leading term −x2(12σj2−12σ12)→−∞-x^2\big(\tfrac1{2\sigma_j^2}-\tfrac1{2\sigma_1^2}\big)\to-\infty. If σj=σ1\sigma_j=\sigma_1 and μj<μ1\mu_j<\mu_1, it is linear, x(μj−μ1)/σ12+const→−∞x(\mu_j-\mu_1)/\sigma_1^2+\text{const}\to-\infty. Either way, as x→+∞x\to+\infty:

  3. Letting x→+∞x\to+\infty in the relation leaves a1=0a_1=0, a contradiction. So the densities are linearly independent, and equal mixtures have equal components and weights. The multivariate case reduces to this one: project onto a generic direction u\mathbf u, along which distinct components (u⊤μj,u⊤Σju)(\mathbf u^\top\boldsymbol\mu_j,\mathbf u^\top\Sigma_j\mathbf u) stay distinct (the exceptional directions form a set of measure zero), and a vanishing combination of multivariate Gaussians would give a vanishing combination of distinct univariate ones.

Label switching. The likelihood, and a posterior under any prior symmetric in the labels, has K!K! symmetric copies of every mode. An MCMC sampler that mixes well visits all of them, so the posterior mean of "μ1\boldsymbol\mu_1" is the same as that of "μ2\boldsymbol\mu_2" and meaningless. Remedies: report only label-invariant quantities (the density, the probability that two points share a cluster), relabel the draws after sampling so as to minimize a posterior expected loss (Stephens, 2000), or impose an ordering such as μ1<μ2\mu_1<\mu_2, which can distort the posterior when components are close.

Overfitted mixtures. Identifiability says nothing about rates. If the fitted KK exceeds the true number K0K_0, the true distribution is matched by a whole set of parameters (an extra component with zero weight anywhere, or a true component split in two), the Fisher information is singular there, and the standard n\sqrt n theory fails. Chen (1995) showed that the mixing distribution can be estimated at rate n−1/2n^{-1/2} when the number of components is known, but at best at rate n−1/4n^{-1/4} when it is unknown.

Check your understanding

A two-component univariate mixture π N(μ1,σ12)+(1−π) N(μ2,σ22)\pi\,\mathcal N(\mu_1,\sigma_1^2)+(1-\pi)\,\mathcal N(\mu_2,\sigma_2^2) is fitted to data from a single N(0,1)\mathcal N(0,1). Which parameter values reproduce the true distribution exactly?

  1. Only π=1\pi=1, μ1=0\mu_1=0, σ1=1\sigma_1=1, with any (μ2,σ2)(\mu_2,\sigma_2)
  2. Only the values with both components equal to N(0,1)\mathcal N(0,1), for any π\pi
  3. None: a mixture of two components cannot equal a single Gaussian
  4. A whole set containing both of the first two families (and the mirror case π=0\pi=0)
Show the answer

D. A whole set containing both of the first two families (and the mirror case π=0\pi=0)

Either one component carries all the weight (and the other is arbitrary), or both components equal N(0,1)\mathcal N(0,1) (and the weight is arbitrary). The truth is a union of curves in parameter space, not a point: this is why overfitted mixtures have singular Fisher information and slower rates.

How many components?

The maximized likelihood never decreases with KK, so it cannot choose KK alone. The textbook fix, a likelihood-ratio test of KK against K+1K+1 components, fails too: under the null the extra component sits on the boundary (πK+1=0\pi_{K+1}=0) or duplicates another, its parameters are not identified, and the statistic does not have the usual χ2\chi^2 limit (McLachlan & Peel, 2000, discuss this and the parametric bootstrap used instead).

The Bayesian information criterion of Schwarz (1978), BIC(K)=−2ℓ(θ^K)+pKlog⁡n\text{BIC}(K)=-2\ell(\hat{\boldsymbol\theta}_K)+p_K\log n, comes from a Laplace approximation to the log marginal likelihood of a regular model. Mixtures are not regular, but BIC still behaves well for choosing KK in practice, and singular learning theory explains why it is conservative: for singular models the negative log marginal likelihood is nLn(w0)+λlog⁡n+Op(log⁡log⁡n)nL_n(\mathbf w_0)+\lambda\log n+O_p(\log\log n), where the real log canonical threshold λ\lambda replaces half the parameter count and is never larger than it (Watanabe, 2009, 2013).

KKbest ℓ\ellpK=6K−1p_K=6K-1BIC =−2ℓ+pKlog⁡n=-2\ell+p_K\log nAIC =−2ℓ+2pK=-2\ell+2p_K
1−92.15-92.155209.83209.83194.30194.30
2−24.26-24.2611104.69104.6970.5270.52
363.5663.5617−40.32\mathbf{-40.32}−93.12-93.12
470.3570.3523−23.26-23.26−94.70\mathbf{-94.70}
573.5273.52291.031.03−89.04-89.04
675.3975.393527.9327.93−80.78-80.78
The widget's three stretched clusters (n=165n=165 points in 2-D, full covariances; best of 12 starts for K≤3K\le3 and 30 for K≥4K\ge4). A full-covariance mixture in d=2d=2 has K−1K-1 weights, 2K2K mean coordinates and 3K3K covariance entries. BIC picks K=3K=3, the true number; AIC, with its lighter penalty, narrowly prefers K=4K=4, where the extra component buys 6.86.8 nats of likelihood, partly by shrinking onto a few points.

Other criteria answer other questions. Held-out (cross-validated) log-likelihood targets density estimation directly and needs no asymptotics. ICL (Biernacki, Celeux & Govaert, 2000) adds to BIC twice the entropy of the responsibilities, −2∑i,kriklog⁡rik-2\sum_{i,k}r_{ik}\log r_{ik}, so it penalizes components that overlap and prefers KK for which the clusters are well separated: the right goal when the mixture is a clustering device, not a density model. AIC targets predictive accuracy and tends to pick more components than BIC.

Infinitely many components: Dirichlet-process mixtures

Instead of choosing KK, a Bayesian can let the number of components be unbounded and let the data decide how many are used. Ferguson's (1973) Dirichlet process DP(α,G0)\mathrm{DP}(\alpha,G_0) is a distribution over discrete probability measures, with concentration α>0\alpha>0 and base measure G0G_0. Sethuraman's stick-breaking construction shows what a draw looks like:

G=∑k=1∞πk δθk,θk∼G0,πk=βk∏j<k(1−βj),βk∼Beta(1,α).G=\sum_{k=1}^\infty\pi_k\,\delta_{\boldsymbol\theta_k},\qquad\boldsymbol\theta_k\sim G_0,\qquad\pi_k=\beta_k\prod_{j<k}(1-\beta_j),\quad\beta_k\sim\mathrm{Beta}(1,\alpha).

A DP mixture, with the random measure used as a mixing distribution (Antoniak, 1974), draws G∼DP(α,G0)G\sim\mathrm{DP}(\alpha,G_0), then θi∼G\boldsymbol\theta_i\sim G and xi∼N(θi)\mathbf x_i\sim\mathcal N(\boldsymbol\theta_i): infinitely many components, of which only finitely many are occupied by any finite data set.

Integrating out GG gives the Chinese restaurant process: the ii-th point joins an existing cluster with nkn_k members with probability nk/(α+i−1)n_k/(\alpha+i-1) and opens a new one with probability α/(α+i−1)\alpha/(\alpha+i-1). Rich clusters get richer, and new clusters keep appearing at a slowing rate. By linearity of expectation, the expected number of occupied clusters is the sum of these new-cluster probabilities:

E[Kn]=∑i=1nαα+i−1 ≈ αlog⁡(1+nα)\E[K_n]=\sum_{i=1}^n\frac{\alpha}{\alpha+i-1}\ \approx\ \alpha\log\Big(1+\frac n\alpha\Big)
The number of clusters grows logarithmically with nn, at a speed set by α\alpha. Gibbs samplers that move points between restaurant tables make this practical (Escobar & West, 1995; Neal, 2000).
Predict before you look

Under a Chinese restaurant process with α=1\alpha=1, how many clusters do n=1,000n=1{,}000 points occupy on average?

Show the answer

7.5

With α=1\alpha=1 the sum is the harmonic number H1000=∑i≤10001/i≈7.49H_{1000}=\sum_{i\le1000}1/i\approx7.49 (the approximation log⁡1001≈6.91\log1001\approx6.91 is a little low). A thousand points occupy only about seven or eight clusters a priori, which is why α\alpha is often given its own prior.

Provable learning and the landscape of EM

Identifiability guarantees that enough data pin down the mixture; it does not say that any efficient algorithm finds it. Theoretical computer science has mapped what is possible:

ResultAssumptionGuarantee
Dasgupta (1999)well-separated Gaussiansthe first provably correct algorithm; time linear in dd, polynomial in KK
Moitra & Valiant (2010)minimal: no separation conditiontime and samples polynomial in dd and 1/ε1/\varepsilon for any fixed KK; an exponential dependence on KK is necessary
Hsu & Kakade (2013)spherical components, means in general position (so K≤dK\le d)a consistent estimator from a spectral decomposition of low-order moments, with no separation condition
Regev & Vijayaraghavan (2017)equal-weight spherical unit-variance componentsseparation of order log⁡K\sqrt{\log K} suffices for poly(K,d)\mathrm{poly}(K,d) samples, and o(log⁡K)o(\sqrt{\log K}) needs superpolynomially many
Li & Liu (2022)samepolynomial time at separation (log⁡K)1/2+c(\log K)^{1/2+c} for any c>0c>0, nearly matching that threshold
The gap between what a few samples determine and what fast algorithms can compute is a recurring theme. For general Gaussian mixtures, statistical-query lower bounds (Diakonikolas, Kane & Stewart, 2017) show a super-polynomial gap between the samples needed and the computation any statistical-query algorithm requires.

EM itself has been analyzed in this spirit. For two components with known covariance, the picture is benign. Balakrishnan, Wainwright & Yu (2017) proved local convergence from a ball around the truth (Why EM Works). Xu, Hsu & Maleki (2016) characterized EM's limit points from every initialization, and Daskalakis, Tzamos & Zampetakis (2017) proved that population EM converges geometrically to the true means, with finite-sample guarantees from a random initialization; in one dimension, ten steps from an initialization at infinity give less than 1% error.

For three or more components the picture flips. Jin, Zhang, Balakrishnan, Wainwright & Jordan (2016) answered an open question of Srebro (2007): even the population likelihood (infinite data) of an equal-weight mixture of well-separated spherical Gaussians can have local maxima arbitrarily worse than the global one, and on such mixtures EM from random initialization converges to a bad critical point with probability at least 1−e−Ω(K)1-e^{-\Omega(K)}. More data cannot fix this; initialization (k-means++ seeding, many restarts) and better algorithms must.

Key takeaways

  • The Gaussian mixture likelihood is unbounded: a component collapsing onto one point sends ℓ→∞\ell\to\infty. Useful estimates are interior local maxima, or maxima under constraints, variance floors or priors.
  • Finite Gaussian mixtures are identifiable up to relabeling (Teicher; Yakowitz & Spragins): the heaviest tail identifies a component, and induction does the rest. Label switching makes per-component posterior summaries meaningless; overfitted mixtures are only weakly identified, with best rate n−1/4n^{-1/4} (Chen, 1995).
  • The likelihood cannot choose KK, and the likelihood-ratio test loses its χ2\chi^2 limit. BIC, −2ℓ+pKlog⁡n-2\ell+p_K\log n, works well in practice; singular learning theory replaces pK/2p_K/2 by the real log canonical threshold. ICL targets well-separated clusters, held-out likelihood targets density.
  • Dirichlet-process mixtures occupy about αlog⁡(1+n/α)\alpha\log(1+n/\alpha) clusters a priori and are good density estimators, but their posterior number of clusters is inconsistent for finite mixtures.
  • Learning mixtures is efficient for fixed KK (Moitra & Valiant) and for spherical components above about log⁡K\sqrt{\log K} separation. EM provably works from almost any start for two balanced components with known covariance, but for three or more there are well-separated mixtures on which bad local maxima trap random starts with probability 1−e−Ω(K)1-e^{-\Omega(K)}.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Why is the global maximizer of an unconstrained Gaussian mixture likelihood not a useful estimator?

  1. It is consistent but too expensive to compute
  2. It does not exist: the likelihood is unbounded, approached by components collapsing onto single points
  3. It always has all components equal
  4. It exists but is not unique, because of label switching
Show the answer

B. It does not exist: the likelihood is unbounded, approached by components collapsing onto single points

Centering a component on a data point and shrinking its covariance sends that point's density, and the log-likelihood, to infinity while the other components keep the remaining points' densities bounded below. Useful fits are interior local maxima, or maxima of a constrained or penalized problem.

Question 2

What does the identifiability theorem for finite Gaussian mixtures guarantee?

  1. The density determines the set of components and their weights, though not their labels
  2. The density determines each component's label
  3. The MLE is unique
  4. EM converges to the true parameters
Show the answer

A. The density determines the set of components and their weights, though not their labels

Equal mixture densities with positive weights and distinct components must have the same multiset of (weight, mean, covariance) triples. Which component is called "1" is arbitrary, hence label switching; and identifiability is a statement about the model, not about any estimator or algorithm.

Question 3

On the widget's three stretched clusters (n=165n=165), the best log-likelihood rises from 63.5663.56 with K=3K=3 to 70.3570.35 with K=4K=4, at the cost of 6 more parameters. Which KK does BIC prefer, and by how much?

  1. K=4K=4, by about 13.6
  2. K=4K=4, by about 6.8
  3. K=3K=3, by about 17.1
  4. Neither: BIC cannot compare different KK
Show the answer

C. K=3K=3, by about 17.1

ΔBIC=−2(70.35−63.56)+6log⁡165≈−13.58+30.64=17.06>0\Delta\text{BIC}=-2(70.35-63.56)+6\log165\approx-13.58+30.64=17.06>0, so K=4K=4 scores worse and BIC keeps K=3K=3. AIC's penalty, 2×6=122\times6=12, is smaller than the likelihood gain of 13.5813.58, which is why AIC narrowly prefers K=4K=4.

Question 4

Data come from a mixture of three Gaussians and are fitted with a Dirichlet-process mixture of Gaussians. As n→∞n\to\infty, what does the posterior on the number of occupied clusters do?

  1. It concentrates on 3
  2. It grows like αlog⁡n\alpha\log n and so diverges
  3. It concentrates on 1, because the DP prefers few clusters
  4. It does not concentrate on 3: small extra clusters keep positive posterior probability
Show the answer

D. It does not concentrate on 3: small extra clusters keep positive posterior probability

Miller & Harrison (2014) proved this inconsistency for Dirichlet- and Pitman–Yor-process mixtures. The DP mixture still estimates the density well, but its cluster count should not be read as an estimate of the number of components; a prior on KK itself (a mixture of finite mixtures) is the consistent alternative.

Further reading

  • G. J. McLachlan & D. Peel, Finite Mixture Models (Wiley, 2000).
  • H. Teicher, "Identifiability of finite mixtures," Annals of Mathematical Statistics 34(4), 1265–1269 (1963).
  • A. Moitra & G. Valiant, "Settling the polynomial learnability of mixtures of Gaussians," IEEE Symposium on Foundations of Computer Science (2010).
  • C. Jin, Y. Zhang, S. Balakrishnan, M. J. Wainwright & M. I. Jordan, "Local maxima in the likelihood of Gaussian mixture models: Structural results and algorithmic consequences," Advances in Neural Information Processing Systems 29 (2016).
  • J. W. Miller & M. T. Harrison, "Inconsistency of Pitman–Yor process mixtures for the number of components," Journal of Machine Learning Research 15, 3333–3370 (2014).