- Introduced by
- Dempster, Laird & Rubin (EM algorithm)
- Year
- 1977
- Type
- Probabilistic (soft) clustering — mixture model
What does it do?
A Gaussian Mixture Model is a probabilistic clustering method that represents the data as a weighted mixture of several Gaussian distributions.
Its parameters are typically estimated with the Expectation–Maximization algorithm, which Dempster, Laird & Rubin presented in 1977 as a general method for maximum likelihood from incomplete data. Because each component has its own covariance, clusters can differ in shape, size, and orientation, which relaxes the restrictions of K-means.
The intuition behind the method
Imagine the data came from a few overlapping bell-shaped clouds, each with its own centre, spread, and tilt. A Gaussian Mixture Model tries to recover those hidden clouds: it estimates how many there are and where they sit. Rather than placing every point in exactly one cluster, it gives each point a probability of belonging to each component. This soft assignment lets it describe stretched or rotated clusters that a spherical, hard-assignment method such as K-means would tend to split incorrectly.
History
The Expectation–Maximization algorithm used to fit Gaussian Mixture Models was formalized by Dempster, Laird & Rubin in their 1977 paper on maximum likelihood estimation from incomplete data. That paper presents EM as a general method and lists finite mixture models among its applications. Its use for fitting Gaussian mixtures as a clustering tool developed from this mixture-model framework.
When to use it
Use a Gaussian Mixture Model when you are clustering or exploring continuous variables whose clusters may overlap, differ in size, or be elongated rather than spherical, and when you want soft membership probabilities instead of hard labels. The method assumes the data arise from a mixture of Gaussians, so it fits best when each subpopulation is roughly bell-shaped. Each component requires d means and d(d+1)/2 covariance entries, plus the mixing weights, so the sample should comfortably exceed the total number of free parameters; the requirement grows quickly with dimension. A common practice is to choose the number of components by comparing BIC or AIC across candidates. Avoid it for very small samples, for strongly non-Gaussian clusters, or for very high-dimensional data without prior dimension reduction; in those cases K-means, which has fewer parameters, or a simpler constrained model may be more stable.
Limitations and considerations
- Assumes each cluster is roughly Gaussian; if that assumption fails, the fitted components may describe the data poorly.
- EM can converge to a local optimum, so the solution depends on initialization.
- Covariance matrices can become singular, particularly in high dimensions or with small samples.
- Each component carries a full covariance matrix, so the number of parameters grows quickly with dimension, and estimates are unstable when observations are few relative to that count.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Soft, probabilistic memberships: each observation receives a responsibility for every component instead of a forced hard label.
- Each component has its own covariance matrix, so clusters can be elongated, rotated, or of different sizes.
- K-means arises as a limiting case: when the components share equal spherical covariances that shrink toward zero, responsibilities become 0 or 1 and assignments become hard. The mixture model relaxes these restrictions.
- The number of components can be compared in a principled way with information criteria such as BIC or AIC.
Applications
- Soft, probabilistic clustering of continuous data in which clusters overlap.
- Exploratory analysis of subpopulations that differ in shape or size.
- Density estimation, representing a data distribution as a weighted mixture of Gaussians.
- A more flexible alternative to K-means when spherical, equal-size clusters are not a realistic assumption.
How it works
How it works
The data is modelled as a weighted sum of K Gaussian distributions. Each component has a mixing weight (weights are non-negative and sum to one), a mean vector, and a covariance matrix, so a component can be elongated or tilted instead of being forced into a sphere. Fitting the model means finding the weights, means, and covariances that make the observed data most likely. There is no closed-form maximum likelihood solution; the parameters are found iteratively.
Formula
p(x) = \sum_{k=1}^{K} \pi_k\, \mathcal{N}(x \mid \mu_k, \Sigma_k)In the E-step, the model computes for each observation the responsibility of every component: the posterior probability that the point was generated by that Gaussian. These soft memberships replace the all-or-nothing assignments of K-means and make overlap between clusters visible.
Formula
\gamma_{ik} = \dfrac{\pi_k\, \mathcal{N}(x_i \mid \mu_k, \Sigma_k)}{\sum_{j} \pi_j\, \mathcal{N}(x_i \mid \mu_j, \Sigma_j)}In the M-step, each component's parameters are re-estimated as responsibility-weighted statistics: the mean is the responsibility-weighted average of the points, the covariance is the responsibility-weighted average of the outer products of deviations from that mean, and the mixing weight is the average responsibility of the component over all N points. The E- and M-steps alternate until the fit converges; the likelihood does not decrease at any iteration, though the procedure may reach a local rather than global optimum.
Formula
\mu_k = \dfrac{\sum_{i} \gamma_{ik} x_i}{\sum_{i} \gamma_{ik}},\quad \Sigma_k = \dfrac{\sum_{i} \gamma_{ik} (x_i-\mu_k)(x_i-\mu_k)^{\top}}{\sum_{i} \gamma_{ik}},\quad \pi_k = \dfrac{1}{N}\sum_{i} \gamma_{ik}The number of components is not fixed in advance. A common practice is to fit several candidate values and compare them with information criteria such as BIC or AIC, which balance goodness of fit against the number of free parameters p; the candidate with the lower value is preferred. Because EM can stop at a local optimum and covariance matrices can become singular, several random restarts and, for high-dimensional data, dimension reduction such as PCA are commonly used as practical remedies.
Formula
\mathrm{BIC} = -2\ln \hat{L} + p\ln N,\quad \mathrm{AIC} = -2\ln \hat{L} + 2pCommon pitfalls
- Fitting on samples that are small relative to the number of free parameters, where EM is more likely to stall in local optima and covariance estimates become unreliable.
- Skipping PCA or another dimension reduction on high-dimensional data, which increases the risk of singular covariance matrices.
- Choosing the number of components by eye rather than comparing BIC or AIC across candidate counts.
- Relying on a single EM run instead of several restarts, so a poor local optimum is accepted as the solution.
- Applying the model to clusters that are clearly non-Gaussian in shape, where the component fit may misrepresent the groups; a non-parametric or density-based method is worth comparing.
Frequently asked questions
How is a Gaussian Mixture Model different from K-means?
K-means assigns each point to exactly one cluster and implicitly assumes spherical clusters of similar size. A Gaussian Mixture Model gives each component its own covariance matrix, so clusters can be elongated, rotated, or differently sized, and every point receives a probability of belonging to each component. K-means can be seen as a limiting case with equal spherical covariances shrinking to zero and hard assignments.
How do I choose the number of components?
Fit the model for several candidate component counts and compare them using information criteria such as BIC or AIC. These criteria reward fit but penalize the number of free parameters; the preferred count is the one with the lower value. Treat this as a practical heuristic and check that the resulting components are interpretable.
Why does my GMM give different results on each run?
The model is fitted with EM, which can converge to a local optimum that depends on the starting values. Running several restarts and keeping the solution with the best likelihood, and reducing dimensions beforehand when there are many features, usually makes the result more stable.
When should I prefer K-means instead?
When the sample is small relative to the number of parameters a mixture must estimate, EM can settle in a local optimum or produce singular covariances. K-means has far fewer parameters and can then be more stable, at the cost of assuming spherical clusters.
Related methods
Sources
Dempster, A.P., Laird, N.M. & Rubin, D.B. (1977). Maximum Likelihood from Incomplete Data via the EM Algorithm. Journal of the Royal Statistical Society: Series B, 39(1), 1–22.
Open DOI referenceData Mining and Analysis (book-20160121), Ch. 13, p. 343