EM algorithm

If major in ML, you will see the EM algorithm which divide into two steps

  1. E step (Exception)
  2. M step (Maximum)

You will be confused only through the step of the algorithm. Let’s explore the inner theory.

Goal

The first thing is to get our aim. eg, we have input and output, we should make a model to fit the data. Our aim is to get the parameter of the model.

we denote θ \theta θ is the parameter, X X X is the input, Y Y Y is the output, Z Z Z is the latent variable.

So we use the condition model to get the P ( Y ∣ θ ) P(Y| \theta) P(Yθ), we will use maximum likelihood to solve it.
L ( θ ) = l o g P ( Y ∣ θ ) L(\theta) = logP(Y| \theta) L(θ)=logP(Yθ)
If there is no latent variable in the model, we can use maximum likelihood directly.

eg: throw a coin for five times, get three up and two down, to calculate the probability of up?

We will use the maximum likelihood to deal. First define the probability of up is θ \theta θ and the output(result) is Y Y Y. So the likelihood function is
L ( θ ) = P ( Y ∣ θ ) L(\theta) = P(Y|\theta) L(θ)=P(Yθ)

We can also get P ( Y ∣ θ ) P(Y|\theta) P(Yθ)
P ( y i ∣ θ ) = θ y i + ( 1 − θ ) 1 − y i P(y_i|\theta) =\theta ^{y_i}+(1-\theta)^{1-y_i} P(yiθ)=θyi+(1θ)1yi

To the end,
L ( θ ) = ∏ i = 1 n ( θ y i + ( 1 − θ ) 1 − y i ) L(\theta) = \prod_{i=1}^{n}(\theta ^{y_i}+(1-\theta)^{1-y_i}) L(θ)=i=1n(θyi+(1θ)1yi)

call by value, and m a x ( L ( θ ) ) max(L(\theta)) max(L(θ)) by making the derivative equal to zero, we get θ = 3 5 \theta = \frac{3}{5} θ=53

BUT in EM algorithm, there is a latent variable in model.

Such as
L ( θ ) = P ( Y , Z ∣ θ ) = P ( Y ∣ Z , θ ) P ( Z ∣ θ ) \begin{aligned} L(\theta)& = P(Y,Z|\theta) \\ & = P(Y|Z,\theta)P(Z|\theta) \end{aligned} L(θ)=P(Y,Zθ)=P(YZ,θ)P(Zθ)

Then
P ( Y ∣ θ ) = ∏ i = 1 n [ π p y i ( 1 − p ) 1 − y i + ( 1 − π ) q y i ( 1 − q ) 1 − y i ] P(Y| \theta) =\prod_{i=1}^{n}[\pi p^{y_i}(1-p)^{1-y_i}+(1-\pi) q^{y_i}(1-q)^{1-y_i}] P(Yθ)=i=1n[πpyi(1p)1yi+(1π)qyi(1q)1yi]

Our aim is to
θ ^ = arg ⁡ max ⁡ θ l o g P ( Y ∣ θ ) \hat \theta = \mathop{\arg \max_{\theta}}logP(Y|\theta) θ^=argθmaxlogP(Yθ)

Proof

We have already get
L ( θ ) = l o g P ( Y , Z ∣ θ ) = l o g P ( Y ∣ Z , θ ) P ( Z ∣ θ ) L(\theta) = logP(Y,Z|\theta) = logP(Y|Z,\theta)P(Z|\theta) L(θ)=logP(Y,Zθ)=logP(YZ,θ)P(Zθ)

In order to m a x ( L ( θ ) ) max(L(\theta)) max(L(θ)), we max it step by step. So we hope through each step, we can always increase the L ( θ ) L(\theta) L(θ)


Jensen Inequity
Let f be a convex function, and let X be a random variable.Then:
E ( f ( X ) ) ≥ f ( E ( X ) ) E(f(X))\ge f(E(X)) E(f(X))f(E(X))


[1] : 《统计学习方法》 李航
[2] : cs229 Andrew Ng http://cs229.stanford.edu/notes/cs229-notes8.pdf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值