8 Mixture models: Modeling implicit group memberships
The chapter introduces mixture models as a way to represent data that appear to come from hidden groups rather than one single source. Instead of forcing a single distribution to explain all observations, a mixture model assumes that each datapoint is generated by one of several latent components, such as different kinds of customers or different eruption patterns. This makes it possible to capture multimodal data, where several peaks or clusters would otherwise be poorly described by one flexible distribution alone.
Using Gaussian mixtures as the main example, the chapter shows how each component has a mean, spread, and weight, with the weights adding to one and indicating how common each hidden group is. It emphasizes that Gaussian mixtures are highly flexible and can approximate a wide range of smooth distributions. The Bayesian version of the model treats the weights, centers, and spreads as random variables, which allows the analysis to express uncertainty about cluster locations, sizes, overlap regions, and the probability that a given observation belongs to each group.
The chapter then applies these ideas to the Old Faithful geyser data, where standardized waiting times clearly suggest two clusters. It explains how to choose priors for the mixture weights, means, and standard deviations, and how label switching can make posterior samples hard to interpret unless the components are ordered consistently. Finally, it extends the idea to an unknown number of clusters using the stick-breaking process, where a concentration parameter controls whether the model favors a few large groups or many small ones. In practice, this lets the data determine how many components matter, while unnecessary components receive negligible weight.
Example data showing multiple spending patterns that can’t be modeled using a single probability distribution.
A single Gaussian distribution cannot adequately model multiple modes within the data. The situation calls for a mixture model, where each component is responsible for capturing a mode.
Mixtures of varying numbers of Gaussians approximating a uniform distribution. As the number of components at our disposal increases, the quality of the approximation becomes higher.
The distribution of standardized waiting times between eruptions from the Old Faithful data.
Variables swap between two trends corresponding to the two clusters, illustrating the label switching problem.
Posterior predictive mean and samples of the mixture model against the observed data. The data lies in the middle of the posterior predictive range, showing that the posterior predictive distribution can model the data well.
Top: the observed data. Bottom: the probability that a given datapoint belongs to either cluster. The cluster membership probabilities reflect the trend in the observe data.
Demonstration of the stick-breaking process for a given list of ratios 𝛽. At each step, we break off the current stick based on the current ratio, and the remaining portion serves as the stick for the next iteration.
The effect of the concentration parameter 𝛼 of the beta distribution for the ratios 𝛽ᵢ on the stick-breaking weights 𝑤ᵢ
Trace plot from the 10-mixture model showing that the model detects 2 clusters from the data—the other clusters are deemed negligible.
The average weights of individual components in the mixture, averaged across posterior samples. Only the first 2 components have non-negligible weights.
Summary
- Mixture models let us handle data that come from multiple hidden groups, without knowing the group of each observation.
- Bayesian mixture models allow us to reason about our uncertainty in the cluster centers, widths, prevalences, and the membership of each datapoint.
- Gaussian mixtures are especially popular: they can approximate any continuous distribution if we use enough components.
- To avoid guessing the number of clusters, we can use the stick-breaking process, an iterative procedure to construct cluster weights. This process provides a prior that allows infinitely many clusters, but in practice only a few matter.
- The concentration parameter 𝛼 of the stick-breaking process controls cluster richness: small 𝛼 favors fewer, larger clusters; large 𝛼 spreads weight across many small clusters.
Grokking Bayes ebook for free