11.1 Gaussian Mixture Models
Soft clusters as a mixture of Gaussians.
These notes walk through the lecture slides. The original deck is unchanged; use (slides) on the course hub if you want that PDF.
Figures and notes follow Géron, Hands-On Machine Learning; Deisenroth, Faisal, and Ong, Mathematics for Machine Learning; and Theodoridis.
1. Gaussian mixture models
A GMM says each row was drawn from a mixture of Gaussians whose parameters you do not know.
One Gaussian → one cluster. Clusters look like ellipsoids. They may differ in shape, size, density, and orientation.

You see an instance. You do not see which Gaussian wrote it, and you do not know the parameters.
2. The generative story
For each , pick a cluster among clusters. The probability of cluster is its weight :
If , draw the location from that Gaussian:
So comes from Gaussians, each with a weight , a mean , and a covariance . Collect those as . The job is to estimate from the observed .
3. Log-likelihood
The log-likelihood is the log probability of the data and the latent cluster ids under :
Maximize this in . Expectation-maximization (EM) does it by alternating an E-step and an M-step until the likelihood stops moving.
4. Expectation-maximization
E-step. Soft assignment: probability that point came from cluster , given the current :
M-step. Update means, covariances, and weights to fit those responsibilities.
Means:
Covariances:
Weights:
Repeat. Each pair of steps raises the likelihood a little. Stop when barely changes.

5. Applications
Image segmentation. Color or texture. Soft membership helps on ambiguous pixels. Lighting and texture can vary; a mixture of Gaussians can still fit the intensities.
Anomaly detection. Model ordinary behavior as a mixture of Gaussians. Deviations are anomalies. Network traffic, transactions, sensors.
Speech. Model features such as Mel-frequency cepstral coefficients (MFCCs). The mixture captures how speech sounds vary; that is a classic acoustic model.
6. Practical notes
Initialization. Random, -means then covariances, or hierarchical. Try more than one; the start matters.
Singular covariances. High dimension, or too few points per cluster. Add a small constant to the diagonal, or PCA the features first.
How many components. BIC or cross-validation. Score with log-likelihood, silhouette, or clustering purity, as appropriate.
Speed. Training is heavy on large or high-dimensional matrices. Use a solid implementation (scikit-learn, TensorFlow). Mini-batches or parallel work if the matrix is huge.
Practice
-
A GMM is a soft clustering. What is being mixed?
-
In the E-step, what is ?
-
Why can two GMM fits on the same data disagree?