← Back to Classic ML Mind Map
📊 Classic MLID: em-algorithm

EM Algorithm

EM 算法
🎯Core Definition
EM (expectation-maximization) is a general framework for maximum likelihood estimation in models with latent variables, alternating between an E-step and an M-step until convergence. The E-step fixes the current parameters θ(t)\theta^{(t)} and forms the expected complete-data log-likelihood under the latent posterior (a lower bound): Q(θ∣θ(t))=EZ∣X,θ(t)[log⁡p(X,Z∣θ)]Q(\theta \mid \theta^{(t)}) = \mathbb{E}_{Z \mid X, \theta^{(t)}}[\log p(X, Z \mid \theta)]; the M-step maximizes it to obtain θ(t+1)=arg⁡max⁡θQ(θ∣θ(t))\theta^{(t+1)} = \arg\max_{\theta} Q(\theta \mid \theta^{(t)}).By Jensen's inequality (log is concave), log⁡p(X∣θ)≥EZ∣X,θ(t)[log⁡p(X,Z∣θ)]+H\log p(X \mid \theta) \ge \mathbb{E}_{Z \mid X, \theta^{(t)}}[\log p(X, Z \mid \theta)] + H, where HH is a constant w.r.t. θ\theta (the entropy of the latent posterior) — every iteration raises this lower bound, so log⁡p(X∣θ)\log p(X \mid \theta) never decreases, though only a local optimum is guaranteed.
💡Use Cases
GMM, HMM (Baum-Welch), missing-data imputation, factor analysis / probabilistic PCA, MT alignment; interviews always probe the E/M step definitions, the Jensen bound, and convergence.
⚡Key Problems Solved
directly maximizing log⁡p(X∣θ)\log p(X \mid \theta) requires summing/integrating over latent variables, which is usually intractable; EM splits the hard problem via the “completed-data” trick — the E-step computes the latent posterior (soft completion), the M-step updates parameters in closed form on the completed sufficient statistics, each step being feasible while the likelihood rises monotonically. The cost: initialization-sensitive and only locally optimal (K-Means is a common GMM init).
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of EM Algorithm.
Use Cases
In production engineering, what are the primary use cases for EM Algorithm and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Write the E-step Q(θ∣θ(t))=EZ∣X,θ(t)[log⁡p(X,Z∣θ)]Q(\theta \mid \theta^{(t)}) = \mathbb{E}_{Z \mid X, \theta^{(t)}}[\log p(X, Z \mid \theta)] and M-step; why is it called expectation-maximization?
2
Use Jensen's inequality to prove EM never decreases log⁡p(X∣θ)\log p(X \mid \theta); when is the lower bound tight?
3
Does EM reach a global or local optimum? Why is it initialization-sensitive? Common strategies such as K-Means to initialize GMM?
4
When is EM applicable — what are latent variables? How does EM handle missing data? vs direct gradient ascent?
5
How does E-step cost scale with the number of latent states? Which EM specializations are GMM and HMM (Baum-Welch)?
📖 In-depth Guide:📄 clustering-and-knn →
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "EM Algorithm"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardDBSCAN & Hierarchical ClusteringNext Card →GMM Soft Assignment

🔗 More Classic ML Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/ML/card/em-algorithm
中文速览与面试要点

EM 算法 (EM Algorithm)

定义: EM (期望最大化) 是含隐变量模型做极大似然估计的通用框架, 交替迭代 E 步与 M 步直到收敛。E 步固定当前参数 ^(t), 构造完整数据对数似然对隐变量后验的期望 (下界): Q( ^(t)) = E_Z X, ^(t)[ p(X, Z )]; M 步极大化该期望得新参数 ^(t+1) = _ Q( ^(t))。由 Jensen 不等式 (对数凹), p(X ) E_Z X, ^(t)[ p(X, Z )] + H, 其中 H 是与 无关的常数 (隐变量后验的熵)——EM 每次迭代都在提升对数似然的下界, 保证 p(X ) 单调不降, 但仅收敛到局部最优。 使用场景: GMM、HMM (Baum-Welch)、缺失数据填补、因子分析/概率 PCA、机器翻译对齐; 面试必考 E/M 步定义、Jensen 下界与收敛性证明。 解决的问题: 直接极大化 p(X ) 需要计算含隐变量的求和/积分, 通常不可解; EM 用“补全数据”技巧把难问题拆成两步——E 步求隐变量后验 (软补全), M 步在补全的充分统计量上闭式更新, 每步计算可行且似然单调上升。代价是初始化敏感、只能收敛到局部最优 (常用 K-Means 初始化 GMM)。

核心要点

  • 写出 EM 的 E 步 Q( ^(t)) = E_Z X, ^(t)[ p(X, Z )] 与 M 步定义? 为什么叫“期望-最大化”?
  • 用 Jensen 不等式证明 EM 每次迭代使 p(X ) 单调不降; 下界何时取等?
  • EM 收敛到全局最优还是局部最优? 为什么对初始值敏感? 常用初始化策略有哪些 (K-Means 初始化 GMM)?
  • EM 的适用条件: 隐变量具体指什么? 如何用 EM 处理缺失数据? 与直接梯度上升最大化的区别?
  • E 步的计算复杂度如何随隐变量取值个数增长? GMM 与 HMM (Baum-Welch) 分别是 EM 的哪个特例?