A Gaussian mixture models each group with a bell curve rather than just a centre. First choose a component with probability then draw from its Gaussian density The weights sum to one, and the overall density is
Given a point reverse the question: how likely is each component to have drawn it? By Bayes’ rule, the responsibility of component is
Divide the component’s weighted curve height by the total height at that point. The responsibilities across components sum to one. A half-and-half answer is allowed: this is soft assignment.
At the midpoint in the figure, the unweighted Gaussian heights are equal. The responsibility for A is still because A has three times the weight. In several dimensions, a component’s covariance also affects its height: a Gaussian can be long and narrow, not just round.
Fit the mixture with EM
If we knew which machine made each part, we could count the parts and estimate each machine’s mean and spread. If we knew the machines’ distributions, we could estimate who made each part. Expectation–maximisation (EM) alternates between those two tasks:
- E-step: using the current weights and Gaussians, calculate every
- M-step: use those responsibilities as fractional counts. With set the weight to and the mean to Update the spread using squared deviations from the new mean, weighted by the same responsibilities.
In one dimension that last update is in higher dimensions use the weighted covariance. A point with responsibility counts four times as much for that component as one with responsibility
These steps do not decrease the data log-likelihood, but the fit can depend on where you start. Compare the two algorithms: k-means updates each centre using only points assigned to it; EM updates each Gaussian using all points, weighted by how much each belongs.