TL;DR
A mixture model says that each data point came from one of several hidden groups, and each group has its own distribution. The overall density is a weighted sum of the group densities. This fits data that looks like several bumps, where a single Gaussian would sit in the wrong place and be too wide.
Where you'll see it: clustering with soft assignments, density estimation for multimodal data such as speaker voices or heights of mixed populations, and the output layer of mixture density networks that predict several possible answers at once.
Intuition
Two groups in one pile
Measure the heights of a group of adults and suppose the sample includes both men and women. The histogram has two humps, one near the women's typical height and one near the men's. A single bell curve fitted to that pile would sit in the middle, where there are few people, and it would be too wide to describe either hump. It answers the question "what is a typical height?" badly.
A mixture model asks a different question. It supposes that each person belongs to a hidden group, which we cannot see in the data. Given the group, the height is roughly Gaussian with that group's mean and spread. The group is a latent variable: a quantity that shapes the data but is never measured. The overall distribution of heights is what you get when you average over the unseen groups, weighted by how common each group is.
That is the whole idea. Pick groups, give each one a bell curve, and give each one a weight that says how common it is. The data then decides the rest.
flowchart TD
Z[Hidden group z] -->|with probability pi_k| X[Observed value x]
Z --> C1[Component 1: N mu1 sigma1]
Z --> C2[Component 2: N mu2 sigma2]
C1 --> X
C2 --> X
The diagram reads from top to bottom. A group is drawn first, then a value is drawn from that group's distribution. The model is only ever shown the value at the bottom.
The math
A mixture of components has density
where are the mixing weights, with , and is the density of component with its own parameters . In the Gaussian mixture, which is the common case, and is the normal density
The weights are the probability that a random point comes from group . The latent variable is the group label, with . Then , which is the law of total probability applied to the hidden label. This is the sense in which a mixture is a latent variable model.
Responsibilities
Given an observed , the posterior probability that it came from component is a Bayes rule calculation:
These numbers are called responsibilities. They sum to 1 for each . A point near the centre of one bump has responsibility close to 1 for that bump and close to 0 for the others. A point between the bumps is shared.
Fitting by maximum likelihood
Given data assumed independent, the log-likelihood is
The sum sits inside the logarithm, so there is no closed-form maximiser. Setting the derivatives to zero gives equations that involve the responsibilities, which in turn depend on the parameters. The usual way out is the expectation-maximisation (EM) algorithm, which alternates between computing responsibilities and re-estimating the parameters. For the Gaussian case, the re-estimates are weighted versions of the familiar formulas:
with a similar weighted average for . Each EM step does not decrease the likelihood, but EM can reach a local maximum, so the result depends on the starting values.
Worked examples
Take two components, with weight and with weight . Consider the point .
- Component 1 density: , where is the standard normal density.
- Component 2 density: .
- Weighted terms: and .
- Mixture density: .
- Responsibility of component 1: .
- Responsibility of component 2: . The two add to 1.
The point is assigned mostly to component 1, even though component 2 has the larger weight. The mean of component 2 is far away, so its density at is tiny. Weights matter less than location once a point is far from a component.
Use the data . Suppose the E-step gave component 2 these responsibilities: . These numbers are chosen for illustration.
- Weight for component 2: the mean of the responsibilities is . So .
- Sum of responsibilities: .
- Weighted sum of data: .
- Mean: .
The new mean of component 2 is , pulled toward the two large points on the right. The points at 0.5 and 1.0 barely affect it because their responsibilities are small. One EM iteration repeats this for component 1 with the complementary responsibilities, then recomputes the responsibilities from the new parameters.
Take two equal groups of people, with heights centred at 160 cm and 180 cm, each with standard deviation 5 cm. Their mixture has equal weights .
- Mixed mean: cm.
- Mixed variance: within-group variance plus the between-group spread gives . So the standard deviation is about cm.
- Density of the single fitted Gaussian at 170 cm: .
- True mixture density at 170 cm: each component is 10 cm from the centre, which is 2 standard deviations, with density . Averaging the two equal-weight components gives .
- The single Gaussian overstates the density at the centre by a factor of about .
The plot below shows both curves. The two-hump density is what the data looks like, and the single curve is what a model with one group would predict.
- two-group mixture
- single Gaussian
Tradeoffs and failure modes
| Situation | Problem | Better choice |
|---|---|---|
| The number of groups is unknown | A wrong either merges real groups or splits one group in two | Compare fits with an information criterion such as BIC, or use a Bayesian nonparametric model |
| Groups are not roughly Gaussian | Gaussian components fit the wrong shape | Use a different family per component, or a flexible density estimator |
| Data has outliers | A narrow component can latch onto a single point and shrink its variance toward zero | Put a floor on variances, or use a robust component such as a Student-t |
| You only need hard cluster labels | Responsibilities are more than the task needs | A hard method such as K-Means Clustering, which is a limiting case with equal spherical components |
| Starting values are poor | EM converges to a poor local maximum | Run several random starts and keep the highest likelihood |
| Components collapse onto the same data | Two components become identical and the model wastes capacity | Initialise means with k-means, and check for near-identical components |
Failure modes to watch: label switching, where the fitted components are the same but their labels are permuted between runs, so comparing components across fits needs matching; and degenerate solutions, where one component explains a single point with a very small variance and the likelihood rises without limit. The second is why practical implementations regularise the variances.
History
The idea of fitting a mixture of normal distributions goes back to the 1890s. Karl Pearson fitted a mixture of two normal curves to a set of measurements on crabs, showing that a single curve could hide two populations. The method was used in biology and astronomy for decades, but estimating the parameters was hard without computers.
The modern algorithm came later. In 1977 Dempster, Laird and Rubin described the expectation-maximisation framework, which gave a general recipe for maximum likelihood with hidden variables. Mixtures of Gaussians became a standard application: they were easy to write down, EM gave a reasonable fit, and they could be used for clustering, density estimation and as building blocks in speech recognition systems from the 1980s and 1990s.
Check yourself
QuestionRecall: what is a mixing weight, and what must the weights of a mixture add up to?Show answer
A mixing weight is the probability that a random observation comes from component , so it is a fraction of the data expected from that group. The weights are non-negative and sum to 1, so that the mixture is a proper probability density.
QuestionComputation: a mixture has weights and . At a point , component 1 has density and component 2 has density . What is the responsibility of component 1 at , to three decimal places?Show answer
The mixture density is . The responsibility is .
QuestionWhy can't the log-likelihood of a mixture be maximised by setting its derivative to zero and solving directly?Show answer
The log of a sum has no simple form. The derivative with respect to a component's mean or variance involves the responsibilities, which themselves depend on all the parameters. The equations are coupled and have no closed-form solution, which is why iterative methods such as EM are used.
QuestionWhy does a mixture model with one component very narrow around a single data point give an unbounded likelihood, and what does that imply for fitting?Show answer
As the variance of that component goes to zero, its density at the matching point goes to infinity, so the likelihood can grow without bound. The maximum likelihood estimate is then degenerate. In practice, the variances are bounded below, or the fit uses a prior, so that a single point cannot dominate the model.
QuestionApplied: you have the heights of 2,000 people, and the histogram shows two humps with an unknown number of groups. How would you choose the model, and what would you check before believing it?Show answer
Fit mixtures with two, three and more components, each by EM from several random starts, and compare them with BIC or held-out likelihood. Choose the number of components that improves the fit enough to justify the extra parameters. Before believing the result, check that the components are not nearly identical, that the variances are not collapsing, and that the fitted groups have a plausible meaning in the data, such as a known split by sex or age. Plot the fitted density over the histogram as a final check.