Known-variance Gaussian mixture EM example 2026-10-14
Choose six illustrative values , fixed mixture weights , known standard deviation , and initial means . These are constructed data for a Gaussian mixture distribution, not measurements. With the standard normal distribution probability density function, the fitted log-likelihood isAt the initial means, the component density ratio is . The first E-step therefore gives
The paired values and have complementary mixture responsibilities, so exactly. The first M-step givesThe hyperbolic tangent expression follows by pairing the contributions at and . Assigning every negative value wholly to the first mixture component and every positive value wholly to the second would instead give means . Those hard assignments discard the overlap: the expectation-maximization algorithm is not the same update as K-means clustering.
The observed-data log-likelihood rises from initially to after one update and after two. Further updates approach means , with log-likelihood approximately . These values describe this initialization; EM likelihood monotonicity supplies no certificate of a global maximum.
Likelihood ascent and mean updates for the chosen data, compared with an identical-means initialization
. Iteration zero is the initial fit; each subsequent point follows one E-step and one M-step. Starting at minus one and one increases the likelihood. Starting both means at zero leaves them at zero with a lower constant likelihood. All runs keep variance one and weights one half. Details.For stable numerical evaluation, put and . The log-sum-exp function givesSubtracting keeps at least one exponential equal to one, avoiding the all-zero sum that direct evaluation of tiny component densities can produce.
Past exam of the mathematics course of the University of Cambridge 2007 iii Paper 48 5 b ii Solution Created 2026-10-03 Updated 2026-10-14
The posterior kernel gives two gamma full conditional distributions directly:with rates as the second parameters. For the index, terms independent of the proposed value cancel. Its conditional weights areDefine and . The normalized categorical probabilities areSubtracting the largest log weight prevents needless numerical overflow, an application of the log-sum-exp function.
Precompute the cumulative counts . Initialize any and positive rates. At each iteration, draw from its gamma conditional given the current index, draw from its gamma conditional given that index, and draw a new index from the categorical probabilities using the newly drawn rates. Repeat and retain the parameter triples after initialization effects have diminished. These are the Gibbs updates for a Poisson count change point.
To verify invariance rather than just identify a sampler, a coordinate update integrates the old joint density as and replaces the first factor by an independent draw from the same conditional. The joint posterior distribution is therefore unchanged. The same argument applies to the other two updates, so their composition preserves the posterior. All gamma densities and all categorical weights are positive on their supports. The full-sweep transition density is consequently positive across the joint support, giving the usual irreducibility and aperiodicity conditions for this proper-posterior Gibbs sampler. This supports posterior long-run averages under the ergodic theorem for a positive Harris recurrent Markov chain.
Past exam of the mathematics course of the University of Cambridge 2007 iii Paper 48 6 b i Solution Created 2026-10-03 Updated 2026-10-14
Introduce a categorical latent variable for each observation, with , and let . Conditional on , has a normal distribution of mean and the shared variance . The complete-data log-likelihood function isInitialize finite means, positive weights summing to one, and a positive common variance. At iteration , the Bayes' theorem gives the E-step mixture responsibilitiesThe common normal-density factor cancels. The observations' conditional labels are independent, and replacing by their conditional expectations givesSet ; because , . The constrained weight maximization uses a Lagrange multiplier : differentiating gives , and summing fixes . Differentiating the residual quadratic in each mean gives . Hence the first two M-step updates areWith these new means define . The remaining objective in is , whose derivative is . For it increases up to and decreases afterwards. Thus the shared-variance update isThe denominator is , not and not a separate count for each component: this is maximum likelihood estimation with one common variance. These are the EM for Gaussian mixtures with a common variance updates. Recompute responsibilities with the new parameters and repeat until the observed-data likelihood changes sufficiently little.
The monotonicity claim also follows directly. For positive old weights, the likelihood ratio for observation isApply the Jensen inequality to the logarithm and sum over observations. This yieldsfor the maximizing M step. This proves likelihood increase, not convergence to the global maximum. Use several initializations to reduce sensitivity to local maxima. Compute responsibilities with a log-sum-exp function normalization to avoid numerical underflow.
If , that component's updated weight is zero and its mean is unidentified; retain its old mean or remove the empty component. Strictly positive interior initialization avoids this case in exact arithmetic while the variance stays positive. If , there is no positive finite variance maximizing this M step: the objective tends to infinity as . Such boundary degeneracy needs a variance constraint or regularization, as discussed in the next solution. For the formulas reduce to the ordinary sample mean and the maximum-likelihood variance .
Past exam of the mathematics course of the University of Cambridge 2023 iii Paper 339 1 c Solution Created 2026-09-28 Updated 2026-10-03
Write . The log-sum-exp function is convex and composition with the affine functions preserves convexity, so is convex. Directly, its Hessian matrix will also be shown positive semidefinite in part d.
The substitution , with , is a bijection onto and obeysThus the log-sum-exp function transfers nonnegative addition to the given set. It is closed, associative and commutative, with identity element . But a finite has , and adding a nonnegative number cannot give zero, so no finite has an inverse element. Therefore it is a commutative monoid but not a group.
Smooth maximum 2026-09-28
Composing the log-sum-exp function with finitely many affine functions gives a differentiable approximation to their pointwise maximum. Increasing the inverse-temperature parameter reduces the uniform approximation error while increasing the Lipschitz gradient constant.

