【李航统计学习笔记】第九章:EM算法

9.1 导论

三硬币模型

假设我们有随机变量 z z z(观测不到的数据): z ∼ b ( 1 , π ) z \sim b(1, \pi) zb(1,π)。针对一系列样本 ( z 1 , y 1 ) ( z 2 , y 2 ) … … ( z N , y N ) \left(z_{1}, y_{1}\right)\left(z_{2}, y_{2}\right) \ldots \ldots\left(z_{N}, y_{N}\right) (z1,y1)(z2,y2)……(zN,yN),满足

  • z 1 = 1 , y 1 ∼ b ( 1 , p ) z_1=1, y_1 \sim b(1, p) z1=1,y1b(1,p)
  • z 1 = 0 , y 1 ∼ b ( 1 , q ) z_1=0, y_1 \sim b(1, q) z1=0,y1b(1,q)

如果 ( z , y ) (z, y) (z,y)是完全数据,则有 p ( y , z ) = p ( z ) ⋅ p ( y ∣ z ) p(y, z)=p(z) \cdot p(y \mid z) p(y,z)=p(z)p(yz)

如果 y y y是不完全数据(观测数据),则有
∏ i = 1 N p ( y i ∣ θ ) = ∏ i = 1 N [ ∑ z p ( y i , z ∣ θ ) ] = ∏ i = 1 N [ π p y i ( 1 − p ) 1 − y i + ( 1 − π ) q y i ( 1 − q ) 1 − y i ⇒ p ( y , z ∣ θ ) , max ⁡ ( ln ⁡ ∏ i = 1 N p ( y i , z i ∣ θ ) ) \prod_{i=1}^{\mathrm{N}} p\left(y_{i} \mid \theta\right)=\prod_{i=1}^{\mathrm{N}}\left[\sum_{z} p\left(y_{i}, z \mid \theta\right)\right]=\prod_{i=1}^{\mathrm{N}}\left[\pi p^{y_{i}}(1-p)^{1-y_{i}}+(1-\pi) q^{y_{i}}(1-q)^{1-y_{i}}\right.\\ \Rightarrow p(y, z \mid \theta), \quad \max \left(\ln \prod_{i=1}^{N} p\left(y_{i}, z_{i} \mid \theta\right)\right) i=1Np(yiθ)=i=1N[zp(yi,zθ)]=i=1N[πpyi(1p)1yi+(1π)qyi(1q)1yip(y,zθ),max(lni=1Np(yi,ziθ))

  • E步: z i → E ( z ) → θ ( i ) , y i z_{i} \rightarrow E(z) \rightarrow \theta^{(i)}, y_{i} ziE(z)θ(i),yi
  • M步: θ ( i + 1 ) = arg ⁡ max ⁡ θ ln ⁡ ∏ i = 1 N ( p i , E ( z ) ∣ θ ) \theta^{(i+1)}=\underset{\theta}{\arg \max } \ln \prod_{i=1}^{N}\left(p_{i}, E(z) \mid \theta\right) θ(i+1)=θargmaxlni=1N(pi,E(z)θ)

算法的引入

EM算法步骤

输入: 观测变量数据 Y Y Y, 隐变量数据 Z Z Z, 联合分布 P ( Y , Z ∣ θ ) P(Y, Z \mid \theta) P(Y,Zθ), 条件分布 P ( Z ∣ Y , θ ) P(Z \mid Y, \theta) P(ZY,θ);

输出 : 模型参数 θ \theta θ

(1) 选择参数的初值 θ ( 0 ) \theta^{(0)} θ(0), 开始迭代 ;

(2) E E E 步 : 记 θ ( i ) \theta^{(i)} θ(i) 为第 i i i 次迭代参数 θ \theta θ 的估计值, 在第 i + 1 i+1 i+1 次迭代的 E E E 步, 计算 Q ( θ , θ ( i ) ) = E Z [ log ⁡ P ( Y , Z ∣ θ ) ∣ Y , θ ( i ) ] Q\left(\theta, \theta^{(i)}\right)=E_{Z}\left[\log P(Y, Z \mid \theta) \mid Y, \theta^{(i)}\right] Q(θ,θ(i))=EZ[logP(Y,Zθ)Y,θ(i)]

(3) M M M 步 : 求使 Q ( θ , θ ( i ) ) Q\left(\theta, \theta^{(i)}\right) Q(θ,θ(i)) 极大化的 θ \theta θ, 确定第 i + 1 i+1 i+1 次迭代的参数的估计值 θ ( i + 1 ) \theta^{(i+1)} θ(i+1) θ ( i + 1 ) = argmax ⁡ θ Q ( θ , θ ( i ) ) \theta^{(i+1)}=\operatorname{argmax}_{\theta} Q\left(\theta, \theta^{(i)}\right) θ(i+1)=argmaxθQ(θ,θ(i))

(4) 重复第 (2) 步和第(3)步,直到收敛。 Q ( θ ( i + 1 ) , θ ( i ) ) ← Q ( θ ( i ) , θ ( i − 1 ) ) Q\left(\theta^{(i+1)}, \theta^{(i)}\right) \leftarrow Q \left(\theta^{(i)}, \theta^{(i-1)}\right) Q(θ(i+1),θ(i))Q(θ(i),θ(i1))

式 (9.9)的函数 Q ( θ , θ ( i ) ) Q\left(\theta, \theta^{(i)}\right) Q(θ,θ(i)) E M E M EM 算法的核心,称为 Q Q Q 函数( Q Q Q function)

定理9.1

P ( Y ∣ θ ) P(Y \mid \theta) P(Yθ) 为观测数据的似然函数, θ ( i ) ( i = 1 , 2 , … ) \theta^{(i)}(i=1,2, \ldots) θ(i)(i=1,2,) E M E M EM 算法得到的参数估计序列, P ( Y ∣ θ ( i ) ) ( i = 1 , 2 , … ) P\left(Y \mid \theta^{(i)}\right)(i=1,2 , \ldots) P(Yθ(i))(i=1,2) 为对应的似然函数序列,则 P ( Y ∣ θ ( i ) ) P\left(Y \mid \theta^{(i)}\right) P(Yθ(i)) 是单调递增的,即
P ( Y ∣ θ ( i + 1 ) ) ≥ P ( Y ∣ θ ( i ) ) P\left(Y \mid \theta^{(i+1)}\right) \geq P\left(Y \mid \theta^{(i)}\right) P(Yθ(i+1))P(Yθ(i))

定理2

L ( θ ) = log ⁡ P ( Y ∣ θ ) L(\theta)=\log P(Y \mid \theta) L(θ)=logP(Yθ) 为观测数据的对数似然函数, θ ( i ) ( i = 1 , 2 , … ) \theta^{(i)}(i=1,2, \ldots) θ(i)(i=1,2,)
E M E M EM 算法得到的参数估计序列, L ( θ ( i ) ) ( i = 1 , 2 , … ) L\left(\theta^{(i)}\right)(i=1,2, \ldots) L(θ(i))(i=1,2,) 为对应的对数似然函数序列。
(1) 如果 P ( Y ∣ θ ) P(Y \mid \theta) P(Yθ) 有上界,则 L ( θ ( i ) ) = log ⁡ P ( Y ∣ θ ( i ) ) L\left(\theta^{(i)}\right)=\log P\left(Y \mid \theta^{(i)}\right) L(θ(i))=logP(Yθ(i)) 收敛到某一值 L L L
(2) 在函数 Q ( θ , θ ′ ) Q\left(\theta, \theta^{\prime}\right) Q(θ,θ) L ( θ ) L(\theta) L(θ) 满足一定条件下,由 E M E M EM 算法得到的参数估计序列 θ ( i ) \theta^{(i)} θ(i) 的收敛值 θ \theta θ L ( θ ) L(\theta) L(θ) 的稳定点。

总结

  1. EM算法通过迭代求解观测数据的对数似然函数的极大化,实现极大似然估计。
  2. EM的极大似然估计中包含两个步骤:E步求期望和M步求极大。
  3. EM算法在每次迭代后均提高观测数据的似然函数值。

9.2 EM算法的导出

L ( θ ) = ln ⁡ P ( Y ∣ θ ) = ln ⁡ ∑ Z P ( Y , Z ∣ θ ) = ln ⁡ ( ∑ Z P ( Z ∣ θ ) P ( Y ∣ Z , θ ) ) L ( θ ) − L ( θ ( i ) ) = ln ⁡ ( ∑ Z P ( Z ∣ θ ) P ( Y ∣ Z , θ ) ) − ln ⁡ P ( Y ∣ θ ( i ) ) = ln ⁡ ( ∑ Z P ( Z ∣ Y , θ ( i ) ) P ( Z ∣ θ ) P ( Y ∣ Z , θ ) P ( Z ∣ Y , θ ( i ) ) ) − ln ⁡ P ( Y ∣ θ ( i ) ) ∑ Z P ( Z ∣ Y , θ ( i ) ) ln ⁡ ( P ( Z ∣ θ ) P ( Y ∣ Z , θ ) P ( Z ∣ Y , θ ( i ) ) ) − ∑ Z P ( Z ∣ Y , θ ( i ) ) ln ⁡ P ( Y ∣ θ ( i ) ) = ∑ Z P ( Z ∣ Y , θ ( i ) ) ln ⁡ ( P ( Z ∣ θ ) P ( Y ∣ Z , θ ) P ( Z ∣ Y , θ ( i ) ) P ( Y ∣ θ ( i ) ) ) \begin{aligned} L(\theta)=\ln P(Y \mid \theta) &=\ln \sum_{Z} P(Y, Z \mid \theta)=\ln \left(\sum_{Z} P(Z \mid \theta) P(Y \mid Z, \theta)\right) \\ L(\theta)-L\left(\theta^{(i)}\right) &=\ln \left(\sum_{Z} P(Z \mid \theta) P(Y \mid Z, \theta)\right)-\ln P\left(Y \mid \theta^{(i)}\right) \\ &=\ln \left(\sum_{Z} P\left(Z \mid Y, \theta^{(i)}\right) \frac{P(Z \mid \theta) P(Y \mid Z, \theta)}{P\left(Z \mid Y, \theta^{(i)}\right)}\right)-\ln P\left(Y \mid \theta^{(i)}\right) \\ & \sum_{Z} P\left(Z \mid Y, \theta^{(i)}\right) \ln \left(\frac{P(Z \mid \theta) P(Y \mid Z, \theta)}{P\left(Z \mid Y, \theta^{(i)}\right)}\right)-\sum_{Z} P\left(Z \mid Y, \theta^{(i)}\right) \ln P\left(Y \mid \theta^{(i)}\right) \\ &=\sum_{Z} P\left(Z \mid Y, \theta^{(i)}\right) \ln \left(\frac{P(Z \mid \theta) P(Y \mid Z, \theta)}{P\left(Z \mid Y, \theta^{(i)}\right) P\left(Y \mid \theta^{(i)}\right)}\right) \end{aligned} L(θ)=lnP(Yθ)L(θ)L(θ(i))=lnZP(Y,Zθ)=ln(ZP(Zθ)P(YZ,θ))=ln(ZP(Zθ)P(YZ,θ))lnP(Yθ(i))=ln(ZP(ZY,θ(i))P(ZY,θ(i))P(Zθ)P(YZ,θ))lnP(Yθ(i))ZP(ZY,θ(i))ln(P(ZY,θ(i))P(Zθ)P(YZ,θ))ZP(ZY,θ(i))lnP(Yθ(i))=ZP(ZY,θ(i))ln(P(ZY,θ(i))P(Yθ(i))P(Zθ)P(YZ,θ))

然后我们有
θ ( i + 1 ) = argmax ⁡ θ B ( θ , θ ( i ) ) = argmax ⁡ θ ∑ Z P ( Z ∣ Y , θ ( i ) ) ( ln ⁡ P ( Z ∣ θ ) P ( Y ∣ Z , θ ) ) = argmax ⁡ θ ∑ Z P ( Z ∣ Y , θ ( i ) ) ( ln ⁡ P ( Y , Z ∣ θ ) ) \begin{aligned} \theta^{(i+1)} &=\underset{\theta}{\operatorname{argmax}} B\left(\theta, \theta^{(i)}\right) \\ &=\underset{\theta}{\operatorname{argmax}} \sum_{Z} P\left(Z \mid Y, \theta^{(i)}\right)(\ln P(Z \mid \theta) P(Y \mid Z, \theta)) \\ &=\underset{\theta}{\operatorname{argmax}} \sum_{Z} P\left(Z \mid Y, \theta^{(i)}\right)(\ln P(Y, Z \mid \theta)) \end{aligned} θ(i+1)=θargmaxB(θ,θ(i))=θargmaxZP(ZY,θ(i))(lnP(Zθ)P(YZ,θ))=θargmaxZP(ZY,θ(i))(lnP(Y,Zθ))
最后
argmax ⁡ θ Q ( θ , θ ( i ) ) \underset{\theta}{\operatorname{argmax}} Q\left(\theta, \theta^{(i)}\right) θargmaxQ(θ,θ(i))

总结
  1. EM算法通过迭代逐步近似极大化L。
  2. 为了每次都能够极大化 L L L ,需保证每个步骤中 L ( θ ) − L(\theta)- L(θ) L ( θ ( i ) ) L\left(\theta^{(i)}\right) L(θ(i)) 大于0。
  3. 通过找到当前 L ( θ ) − L ( θ ( i ) ) L(\theta)-L\left(\theta^{(i)}\right) L(θ)L(θ(i)) 的下界,不断提高该下界即可。

9.3 高斯混合模型

(to be continue )

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
李航的《统计学习方法》是一本经典的统计学习教材,其中涵盖了统计学习的基本理论和方法。该书主要介绍了统计学习的三要素:模型、策略和算法。引用提到,训练集用来训练模型,验证集用来选择模型,测试集用于对学习方法的评估。这些三要素是统计学习方法的基础。引用进一步解释了统计学习的目标,即通过构建概率统计模型对数据进行准确的预测与分析,并提高学习效率。引用提到了一种常用的统计学习方法,即提升(boosting),它通过改变训练样本的权重,学习多个弱分类器,并将它们线性组合成一个强分类器,以提高分类的性能。 总结起来,李航的《统计学习方法》笔记主要围绕统计学习的基本理论和方法展开,介绍了统计学习的三要素、目标和提升等常用方法。这本书对于学习统计学习的人来说是一本非常有价值的参考资料。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [统计学习方法——李航 笔记](https://blog.csdn.net/qq_45383347/article/details/110482540)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [李航统计学习方法》学习笔记](https://blog.csdn.net/liuzuoping/article/details/98840923)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值