Expectation-maximization algorithm Created 2026-10-03 Updated 2026-10-14
The expectation-maximization algorithm fits a latent-variable model by alternating a conditional expectation over the latent variables with a maximization over the statistical parameters. Its target is the observed-data likelihood function, although its updates use the simpler complete-data log-likelihood.[ref]
Write for the observations, for the latent variables, and for their joint probability density function or probability mass function. The observed-data log-likelihood is
where the integral becomes a sum for discrete . Directly maximizing a logarithm of this sum can be awkward. The E-step instead computes a conditional distribution at the current statistical parameters ; the M-step uses it to construct a new fit. The attractive idea is to retain uncertainty about the hidden labels while recovering simple weighted means and other complete-data updates. The Known-variance Gaussian mixture EM example shows the mechanism without estimating a variance or mixture weight.
Arthur Pentland Dempster, Nan M. Laird, and Donald B. Rubin gave the general framework its name in their 1977 paper, which also discusses earlier special-case algorithms.[ref]
Identical-mean EM trap 2026-10-14
In the Known-variance Gaussian mixture EM example, initialize both means at the same value . The mixture responsibilities are then for every observation. Each M-step sets both means to the sample mean, zero here; the next E-step again gives . Thus is a fixed point with log-likelihood , despite the better fit found from .
One can check the failure without trusting an iteration plot. Separate the means as and use the hyperbolic cosine identity:
The Taylor expansion uses . Small nonzero separation therefore improves the log-likelihood, whereas translating both means to changes it by . This stationary point has both improving and worsening directions. Identical initialization cannot discover the separation because every observation keeps identical label probabilities. Trying several distinct initial fits and comparing their final log-likelihoods is useful, but does not prove global optimality.
Keeping the variance fixed also removes a different pathology. With known , every component probability density function is at most , so . If separate component variances are allowed to shrink without restriction, one mixture component can concentrate at an observation while another retains positive density at the other observations, making the likelihood function unbounded. The fixed positive variance in this example prevents that collapse; it does not remove initialization traps.