EM Algorithm EM算法

EM Algorithm EM算法


EM algorithm is a iterative optimazation algorithm. EM is the abbreviation of expectation maximization. EM do not apply for all the optimization problems.

Remember! EM always converge but it can be a local optima.

EM applys for GMM, K-Means clustering, HMM, etc.

Jensen’s Inequality

convex function f,f>0f, f'' > 0; concave function f,f<0f, f''<0
E[f(x)]f(E[x])     fE[f(x)] \geq f(E[x]) \ \ \ \ \ f is convex
E[f(x)]f(E[x])     fE[f(x)] \leq f(E[x]) \ \ \ \ \ f is concave
If and only if xx is constant equal sign is taken.
图片来源
EM Algorithm EM算法

EM

{zi}i=1N\{z_i\}_{i=1\sim N}xix_i belongs to (zi)th(z_i)^{th} distribution
Qi(zi)Q_i(z_i) — the probability distribution of ziz_i
(You can also turn ziz_i into a vector and each dimension represents the probability.)


MLE:
l(θ)=i=1Nlog[ziP(xi,ziθ)]l(\theta) = \sum\limits_{i=1}^N\log[\sum\limits_{z_i} P(x_i,z_i|\theta)]


θi\theta_i — the parameter of ithi^{th} iteration

randomize θ0while(!converge){        Estep:                 Qi(zi)=P(xi,ziθk)ziP(xi,ziθk)        Mstep:                 θk+1=argmaxθi=1NziQi(zi)logP(xi,ziθ)Qi(zi)}randomize \ \theta_0 \\ while (!converge) \\ \{ \\ \ \ \ \ \ \ \ \ E-step: \ \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Q_i(z_i) = \frac{P(x_i, z_i|\theta_k)}{\sum\limits_{z_i} P(x_i,z_i|\theta_k)} \\ \ \ \ \ \ \ \ \ M-step: \ \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \theta_{k+1} = \arg\max\limits_{\theta}\sum\limits_{i=1}^N\sum\limits_{z_i} Q_i(z_i)\log \frac{P(x_i,z_i|\theta)}{Q_i(z_i)}\\ \}

Jensen’s inequality applys in M-step and the prove of convergence. More details