Hidden Markov Model (HMM)
I. Notations
observation sequence: U={ut | t∈}={u1,u2,...,uT}
hidden state sequence: S={st | t∈}={s1,s2,...,sT}
number of observations: T number of states: M
parameter sets:
λ=(π,A,B)
II. Joint and Marginal Distributions
III. Important pre-defined terms:
αk(t)≡P(u1:t, st=k | λ) with initial αk(1)=πkbk(u1) and recursions αk(t)=(∑Ml=1αl(t−1)alk)bk(ut)
βk(t)≡P(ut+1:T | st=k,λ) with initial βk(T)=1 and recursions βk(t)=(∑Ml=1aklbl(ut+1)βl(t+1))
Lk(t)≡P(st=k, | U,λ) , conditional probability of being in state k at time
t with given observations U .
Lk(t)≡P(st=k, | U,λ)=P(U,st=k | λ)P(U | λ)=P(u1:t,st=k | λ)P(ut+1:T | st=k,λ)P(U | λ)=αk(t)βk(t)P(U | λ)Hk,l(t)≡P(st=k,st+1=l | U,λ) , conditional probability of being in state k at time
t and in state l at timet+1 with given observations U .
Hk,l(t)≡P(st=k,st+1=l | U,λ)=P(U,st=k,st+1=l | λ)P(U | λ)=αk(t)aklbl(ut+1)βl(t+1)P(U | λ)
IV. HMM Problem I:
Compute
P(U | λ)
using Forward-Backward algorithm
V. HMM Problem II:
Compute Ŝ =argmaxSP(S | U) using Viterbi algorithm
then problem II can be written as
with further define
- Initialize V1(k)=−logπkbk(u1) ∀ 1≤k≤M
- Compute
Vt(k)
with recursions
Vt(k)=maxl(Vt−1(l)−logalkbk(ut))∀ 1≤k≤M,2≤t≤T - Get the minimum value W(S)=min1≤k≤MVT(k)
- Trace back to find the optimal state path {sT,sT−1,...,s1}
V. HMM Problem III:
Compute λ̂ =argmaxλP(u | λ) using Baum-Welch algorithm
Baum-Welch algorithm is the EM estimation of HMM parameters
E-Step: under current set of parameters λold , compute αk(t) , βk(t) , Lk(t) , Hk,l(t)
M-Step: update parameters
+ For Discrete HMM:
- For Gaussian HMM:
π̂ k=Lk(1)∑Mk=1Lk(1)â kl=∑T−1t=1Hk,l(t)∑T−1t=1Lk(t)μ̂ k=∑Tt=1Lk(t)ut∑Tt=1Lk(t)Σ̂ k=∑Tt=1Lk(t)(ut−μk)(ut−μk)T∑Tt=1Lk(t)