← Back to Classic ML Mind Map
📊 Classic MLID: hmm-evaluation

HMM Forward Algorithm (Evaluation)

HMM 前向算法 (评估)
🎯Core Definition
The evaluation problem asks for the observation probability P(O∣λ)P(O \mid \lambda) given HMM parameters λ=(A,B,π)\lambda = (A, B, \pi) and an observation sequence O=o1o2…oTO = o_1 o_2 \dots o_T. Summing over state sequences requires NTN^T paths, which is intractable; the forward algorithm defines forward variables αt(j)=P(o1…ot,qt=j∣λ)\alpha_t(j) = P(o_1 \dots o_t, q_t = j \mid \lambda) — the joint probability of being in state jj at time tt after emitting o1…oto_1 \dots o_t — and recurses
📌Overview
αt(j)=[∑iαt−1(i) aij]bj(ot),\alpha_t(j) = \Bigl[\sum_{i} \alpha_{t-1}(i)\, a_{ij}\Bigr] b_j(o_t),
📌Overview
initialized with α1(j)=πjbj(o1)\alpha_1(j) = \pi_j b_j(o_1) and terminating at P(O∣λ)=∑jαT(j)P(O \mid \lambda) = \sum_j \alpha_T(j). Each step sums NN transitions for each of NN states, reducing the cost from O(NT)O(N^T) path enumeration to O(N2T)O(N^2 T).
💡Use Cases
scoring sequences in speech recognition and bio-sequence analysis, and as the E-step machinery of Baum-Welch; interviews often ask for the forward-variable definition and how forward differs from Viterbi (sum vs max).
⚡Key Problems Solved
direct summation over hidden states is exponential, and the forward algorithm caches subproblems to make likelihood computation polynomial; the cost is an O(N2)O(N^2) transition sum per step and O(NT)O(NT) storage (rollable to O(N)O(N)).
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of HMM Forward Algorithm (Evaluation).
Use Cases
In production engineering, what are the primary use cases for HMM Forward Algorithm (Evaluation) and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Write the forward recursion αt(j)=[∑iαt−1(i)aij]bj(ot)\alpha_t(j) = [\sum_i \alpha_{t-1}(i)a_{ij}]b_j(o_t) with its initialization α1(j)\alpha_1(j) and termination P(O∣λ)P(O \mid \lambda)?
2
Why is naive computation of P(O∣λ)P(O \mid \lambda) exponential in O(NT)O(N^T), and how does the forward algorithm reduce it to O(N2T)O(N^2T)?
3
How do the forward algorithm and Viterbi differ (sum vs max, and what each outputs)?
4
What is the probabilistic meaning of αt(j)\alpha_t(j), and how does it combine with the backward variable βt(j)\beta_t(j) to give P(qt=j∣O,λ)P(q_t = j \mid O, \lambda)?
5
Compute P(O∣λ)P(O \mid \lambda) by hand for a concrete HMM (e.g. N=2N=2, T=3T=3), showing each forward step?
📖 In-depth Guide:📄 probabilistic-models →
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "HMM Forward Algorithm (Evaluation)"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardNaive BayesNext Card →Viterbi Decoding

🔗 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/hmm-evaluation
中文速览与面试要点

HMM 前向算法 (评估) (HMM Forward Algorithm (Evaluation))

定义: 评估问题是给定 HMM 参数 = (A, B, ) 与观测序列 O = o_1 o_2 o_T,求观测概率 P(O )。直接对状态序列求和共有 N^T 条路径,不可行;前向算法用动态规划定义前向变量 _t(j) = P(o_1 o_t, q_t = j )(到 t 时刻处于状态 j 且已输出前 t 个观测的联合概率),递推 _t(j) = [ _i _t-1(i)\, a_ij ] b_j(o_t) 初始 _1(j) = _j b_j(o_1),终止 P(O ) = _j _T(j)。每个时刻对 N 个状态各做 N 次转移求和,复杂度由枚举路径的 O(N^T) 降为 O(N^2 T)。 使用场景: 语音识别、生物序列分析中的序列打分,也是 Baum-Welch E 步的组成部分;面试常考前向变量定义、与前向/维特比“求和 vs 取 max”的区别。 解决的问题: 状态不可观测导致直接求是指数级爆炸,前向算法通过缓存子问题将似然计算降到多项式时间;代价是每步 O(N^2) 的转移求和与 O(NT) 存储(可滚动优化为 O(N))。

核心要点

  • 写出前向算法递推 _t(j) = [ _i _t-1(i)a_ij]b_j(o_t),并说明初值 _1(j) 与终止条件 P(O )?
  • 为什么直接计算 P(O ) 是指数级 O(N^T)?前向算法如何把复杂度降到 O(N^2T)?
  • 前向算法与维特比算法有什么区别(求和 vs 取 max、各自输出什么)?
  • 前向变量 _t(j) 的概率含义是什么?它如何与后向变量 _t(j) 组合得到 P(q_t = j O, )?
  • 给定具体 HMM(如 N=2、T=3),手算 P(O ) 的完整数值过程?