For a mixture of Bernoulli distributions on binary vectors x∈{0,1}D, with p(x)=∑kπk∏dμkdxd(1−μkd)1−xd, how do you derive the E-step and M-step updates of EM?

Probabilistic models, EM algorithm
Level L3 Intermediate. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can carry the EM recipe through for a discrete mixture: responsibilities, then maximise the expected log-likelihood with a Lagrange multiplier.

Key idea

E-step: rnk∝πk∏dμkdxnd(1−μkd)1−xnd. M-step: πk=Nk/N and μkd=∑nrnkxnd/Nk, where Nk=∑nrnk.

Steps

  1. Introduce a hidden component label zn. The expected complete-data log-likelihood is Q=∑n∑krnk[ln⁡πk+∑d(xndln⁡μkd+(1−xnd)ln⁡(1−μkd))].
  2. E-step: rnk=P(zn=k∣xn)=πk p(xn∣k)/∑jπj p(xn∣j).
  3. M-step for μkd: set ∂Q/∂μkd=∑nrnk[xnd/μkd−(1−xnd)/(1−μkd)]=0. This gives ∑nrnk(xnd−μkd)=0, so μkd=∑nrnkxnd/Nk, the responsibility-weighted mean.
  4. M-step for πk: maximise ∑n,krnkln⁡πk+λ(1−∑kπk). Then Nk/πk=λ. Summing over k gives λ=N, so πk=Nk/N.
  5. In practice, compute rnk in log space (log-sum-exp), because the product over D dimensions underflows. Clip μkd away from 0 and 1 to avoid ln⁡0.

Common mistakes

How long your answer should be

A page. About 6 minutes.

Last checked on 4 December 2026.

Read this

Previous in Probabilistic models: For the linear-Gaussian model xt=Axt−1+wt with wt∼N(0,Q), and yt=Hxt+vt with vt∼N(0,R), how do you derive the Kalman filter predict and update equations from the conditioning rule for Gaussians?
Next in Probabilistic models: For Bayesian linear regression with prior w∼N(0,α−1I) and likelihood t∼N(Φw,β−1I), how do you derive the posterior p(w∣t) by completing the square, and how does its mean relate to ridge regression?