Lecture 11c
Overview
Gaussian mixture models (GMMs) represent data as weighted Gaussian components, enabling soft cluster probabilities and hard assignments through the most probable component. The lecture derives the expectation-maximization (EM) updates for component weights, means, and covariances, then compares GMMs with K-means and spectral clustering through convergence illustrations, RGB color quantization, and examples of cluster shapes.
Key takeaways
- A GMM's posterior probabilities form a soft assignment over K components; selecting the largest posterior converts that uncertainty into a hard cluster label.
- For GMM fitting, EM uses per-sample cluster indices as hidden variables, computes their posterior responsibilities, and updates each component's weight, mean, and covariance.
- The GMM weight update is the sum of a component's responsibilities divided by the sample count, while its mean and covariance are responsibility-weighted data statistics.
- GMMs can model elongated clusters and curved decision boundaries through component covariances, unlike K-means' piecewise-linear Voronoi regions, but both methods can converge to local minima.
- RGB color quantization treats each pixel as a three-dimensional point; fitting 16 components from 1,000 sampled pixels can produce a 16-color palette for an image of about 273,000 pixels.
- Spectral clustering can separate nonconvex patterns such as two moons and concentric circles, while conventional GMM and K-means methods are mainly suited to low-dimensional data.
Chapters
- A Gaussian mixture model combines K Gaussian PDFs with component means, covariance matrices, and weights that sum to one.
- A hidden cluster index κ makes each weight interpretable as a component prior and each Gaussian as the conditional distribution of X given κ.
- Bayes' rule gives the posterior probability that a sample belongs to each component; the full probability vector is a soft assignment, while choosing its largest entry gives a hard assignment.
- Posterior probabilities can be similar near curved decision boundaries, so hard clustering discards uncertainty that soft assignments preserve.
- Fitting a GMM means estimating all component weights, means, and covariance matrices from the observed samples.
- The log-likelihood contains a logarithm of a sum over components, preventing the simple quadratic simplification available for a single Gaussian.
- Because the objective is non-convex, the lecture introduces expectation-maximization as an iterative approximation to maximum-likelihood estimation.
- EM alternates an E step over hidden variables with an M step over model parameters.
- The E step computes an expectation of the joint log-probability of observed data and hidden variables under the current parameter estimate.
- A decomposition of log-likelihood into a lower-bound term, entropy, and nonnegative KL divergence explains why the bound never exceeds the likelihood.
- Each iteration tightens the bound at the current estimate, then maximizes it over parameters, avoiding direct optimization of a difficult objective.
- The lecture contrasts this with gradient descent on a nonsmooth objective, which can bounce between slopes instead of converging.
- The M step maximizes the expected complete-data log-likelihood over component weights, means, and covariances.
- Because the K mixture weights must sum to one, a Lagrange multiplier enforces the equality constraint during optimization.
- The weight update sets each component's new weight to its total responsibility across samples divided by the number of samples.
- Responsibilities are computed using the previous iteration's weights and Gaussian parameters.
- Each new component mean is a responsibility-weighted empirical average of the data points.
- Each covariance update uses weighted outer products of deviations from that component's updated mean.
- The lecture summarizes EM as repeatedly computing responsibilities, then updating weights, means, and covariance matrices until changes become small.
- Because the joint parameter optimization is difficult, the derivation updates parameter groups in turn.
- K-means++ supplies initial hard assignments, component weights, empirical means, and empirical covariance matrices for a GMM.
- Initial mixture weights are set to the fraction of samples assigned to each K-means cluster.
- For high-dimensional features, replacing a full D-by-D covariance with a diagonal matrix reduces the number of covariance parameters from D² to D.
- The covariance simplification lowers storage and optimization costs but restricts the model's ability to represent correlated features.
- A two-component illustration begins with means at initial points and scaled-identity covariances, whose equal-cost contours are circles.
- Each sample's responsibility is visualized as a color: blue and red indicate high probability for one component, while purple indicates nearly equal probabilities.
- As weighted means and covariances update, circular contours become ellipses that better follow the data's shape.
- Iterations shown at T = 1, 2, 5, and 20 progressively separate the components; EM generally changes gradually rather than stopping after a fixed finite number of steps.
- GMM computes soft posterior assignments and estimates component covariances and weights; K-means returns hard assignments and implicitly favors spherical, similarly weighted clusters.
- K-means creates piecewise-linear Voronoi boundaries, while unequal GMM covariances can produce curved decision boundaries.
- Both methods can converge to local minima and benefit from good initialization, but GMM is more computationally expensive.
- Scikit-learn provides both methods, with GMM options including component count, covariance type, initialization, and iteration limit.
- An RGB pixel is a three-dimensional feature vector, with 8 bits per color channel and 2²⁴, or nearly 17 million, possible colors.
- Color quantization uses clustering to replace the image's colors with a smaller palette, here 16 components, while retaining the original pixel resolution.
- The demonstration fits clusters using a random sample of 1,000 pixels from an image containing about 273,000 pixels, then assigns the remaining pixels to palette colors.
- GMM and K-means both simplify smooth sky gradients and fine details; GMM preserves the island more effectively in the displayed comparison, at greater computational cost.
- Standard K-means and GMM require the number of components K in advance; Bayesian Gaussian mixtures, mean shift, affinity propagation, and Dirichlet processes are examples of alternatives that can select cluster counts.
- GMM handles elongated Gaussian-like clusters and clusters with different sizes better than K-means, but its elliptical components struggle with the two-moons shape.
- Spectral clustering applies a feature transformation that can separate nonconvex structures such as two moons and concentric circles.
- A GMM can represent concentric circles with components sharing a center but having different variances, though EM may settle at a local minimum.
- Traditional clustering algorithms work best on low-dimensional data; a common high-dimensional strategy is to use a neural network to create a lower-dimensional representation before clustering.
- The final multiple-choice exam is scheduled for Friday and covers material after the previous exam, including trees, large language models, clustering, PCA, and NMF.
- The course project is due Wednesday, and students are advised to test a GitHub upload early rather than waiting for the final model.
- Early repository checks help catch upload or consistency problems before the project deadline.
Transcript excerpt
0:01 All right, let's get started. So, um just to review where we were last time, we were talking about [clears throat] Gaussian mixture models. Gaussian mixture model is a weighted sum of different Gaussian PDFs. Um and it's expressed in the PDF domain like this. So each of these is the Gaussian uh PDF one component and you can see that all the PDFs can have different means and covariances and then these are the weights. Um [clears throat] the weight tells us the probability that the sample comes from the Kth component. Um and we have a picture here we're using two components in two dimensions um with probably roughly the same weight,
0:47 but you can see that the means the centers are different and then the covariances are also different. [clears throat] And we can use this probabilistic model to cluster. So the first step is we fit the GMM parameters to the data set. So we have to fit the mus, the Qs, and the gammas to the data set which is our X Is. And [snorts] then um we can cluster any sample. Could be a sample from the data set or a new sample X by determining which of these components is most probable. [clears throat] And to understand what we mean there, it helps to write um the PDF
1:34 in a slightly different way where we explicitly um come up with a random variable. We'll use kappa for the cluster index. And now we can interpret this weight as the probability that the kappa, the cluster index equals K. And we can interpret this is the probability uh the PDF of X given kappa equals K. Okay, so now we've rewritten the GMM explicitly using this variable kappa, which is known as a hidden variable because it's not
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Prof. Schniter.