Gaussian Mixture Model 高斯混合模型 GMM

Gaussian Mixture Model 高斯混合模型 GMM


Gaussian Mixture Model 高斯混合模型 GMM

Gaussian mixture model is a combine of multiple Gaussian models. These Gaussian models mixture according to ‘weight’ π\pi. The picture is a mixture of two models.


GMM

{P(Xc)=k=1KπkN(x(n)μk,Σk)N(x(n)μk,Σk)=1(2π)d2Σk12exp[12(x(n)μk)TΣ1(x(n)μk)]k=1Kπk=1 \left\{\begin{array}{l} P(X|c) = \sum\limits_{k=1}^K\pi_kN(x^{(n)}|\mu_k, \Sigma_k) \\ N(x^{(n)}|\mu_k, \Sigma_k) = \frac{1}{(2\pi)^{\frac d2}|\Sigma_k|^{\frac12}}exp[-\frac12(x^{(n)}-\mu_k)^T\Sigma^{-1}(x^{(n)}-\mu_k)] \\ \sum\limits_{k=1}^K \pi_k= 1 \end{array}\right.

πk\pi_k – the probability of one example belongs to the kthk^{th} Gaussian model/the weight of kthk^{th} model in the mixture model

Attention! GMM is not a convex function and it has local optima(k local optima). What shall we do?
Strategies:
(i) gradient descent
(ii) heuristic algorithm including Simulated Annealing, Evolutionary Algorithms, etc (People hardly use these algorithms nowadays)
(iii)EM algorithm Today’s superstar

EM Algorithm for GMM

general EM Algorithm

Pros and cons

Cons:

  1. EM algorithm is not a general algorithm dealing with non-convex problem.

Pros:

  1. No hyper-parameters
  2. Simple coding work
  3. Theoretically graceful

EM for GMM

γnk\gamma_{nk} – the probability of x(n)x^{(n)} belongs to kthk^{th} model
NkN_k – the expectation of #examples belong to kthk^{th} model

randomize{πk,μk,Σk}k=1Kwhile(!converge){        Estep:                 γnk=πkN(xnμk,Σk)k=1KN(xnμk,Σk)        Mstep:                 Nk=k=1Kγnk                for(k models)                {                        πk(new)=NkN                        μk(new)=1Nkn=1Nγnkx(n)                        Σk(new)=1Nkn=1Nγnk[x(n)μk(new)][x(n)μk(new)]T                {}randomize \{\pi_k,\mu_k,\Sigma_k\}_{k=1\sim K} \\ while (!converge) \\ \{ \\ \ \ \ \ \ \ \ \ E-step: \ \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \gamma_{nk} = \frac{\pi_kN(x_n|\mu_k, \Sigma_k)}{\sum\limits_{k=1}^KN(x_n|\mu_k, \Sigma_k)} \\ \ \ \ \ \ \ \ \ M-step: \ \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ N_k= \sum\limits_{k=1}^K\gamma_{nk} \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ for(k \ models) \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{ \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \pi_k^{(new)}=\frac{N_k}{N} \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mu_k^{(new)} = \frac{1}{N_k}\sum\limits_{n=1}^N\gamma_{nk}x^{(n)} \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \Sigma_k^{(new)} = \frac{1}{N_k}\sum\limits_{n=1}^N\gamma_{nk}[x^{(n)}-\mu_k^{(new)}] [x^{(n)}-\mu_k^{(new)}] ^T \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{ \\ \}
We use soft discrimination in this application of EM algorithm, which means we will compute the probability of each examples belongs to all models. In other applictions, take K-Means clustering algorithm for example, we use winner-takes-all strategy.