Professional Documents
Culture Documents
Introduction To Hidden Markov Models
Introduction To Hidden Markov Models
Models
Markov Models
Set of states: {s1 , s2 , , s N }
Process moves from one state to another generating a
sequence of states : si1 , si 2 , , sik ,
Markov chain property: probability of each subsequent state
depends only on what was the previous state:
0.7
Rain
Dry
0.2
0.8
P({Dry,Dry,Rain,Rain} ) =
P(Rain|Rain) P(Rain|Dry) P(Dry|Dry) P(Dry)=
= 0.3*0.2*0.8*0.6
States are not visible, but each state randomly generates one of
{v1 , v2 , , vM }
M observations (or visible states)
To define hidden Markov model, the following probabilities
have to be specified: matrix of transition probabilities A=(aij),
0.7
Low
High
0.2
0.6
Rain
0.4
0.8
0.4
0.6
Dry
P(High|Low)=0.7 , P(Low|High)=0.2,
P(High|High)=0.8
Observation probabilities : P(Rain|Low)=0.6 ,
P(Dry|Low)=0.4 , P(Rain|High)=0.4 ,
P(Dry|High)=0.3 .
Initial probabilities: say P(Low)=0.4 , P(High)=0.6 .
P({Dry,Rain} , {Low,Low})=
P({Dry,Rain} | {Low,Low}) P({Low,Low}) =
P(Dry|Low)P(Rain|Low) P(Low)P(Low|Low)
= 0.4*0.4*0.6*0.4*0.3
M=(A, B, )
and the
0.5
0.03
0.005
z 0.31
Hidden state
Observation
B bi (v ) P(v | si )
Buffalo
0.5
0.03
0.4
0.6
o
b
s1
s2
s3
Transition probabilities
Observation probabilities
s1 s1 s2s3
s1 s2 s2s3
s1 s2 s3s3
.8 .2 .2
.9 0 .8 .9 =
.2 .8 .2
.9 .1 .8 .9 = 0.0020736
.2 .2 1
.9 .1 .1 .9 = 0.000324
Total = 0.0023976
Transition probabilities
Observation probabilities
s1 s1 s2s3
s1 s2 s2s3
s1 s2 s3s3
.8 .2 .2
.9 0 .2 .6 =
.2 .8 .2
.9 .8 .2 .6 = 0.0027648
.2 .2 1
.9 .8 .4 .6 = 0.006912
Total = 0.0096768
Evaluation Problem.
Evaluation problem. Given the HMM
M=(A, B, )
and the
ok
ok+1
s1
s1
s2
a1j
oK =
Observations
s1
s2
s2
sj
si
a2j
si
si
aij
aNj
Time=
sN
sN
sN
sN
k+1
Forward recursion:
Termination:
Complexity :
N2K operations.
K(i)= 1 , 1<=i<=N.
Backward recursion:
Termination:
Decoding problem
Decoding problem. Given the HMM
M=(A, B, )
and the
General idea:
s1
si
qk
a1j
aij
aNj
sj
sN
k(i) = max P(q1 qk-1 , qk= sj , o1 o2 ... ok) =
maxi [ aij bj (ok ) max P(q1 qk-1= si , o1 o2 ... ok-1) ]
To backtrack best path keep info that predecessor of sj was si.
Initialization:
Forward recursion:
P(O | M) - Baum-Welch
algorithm.
vm occurs in state si
Number of times in state si
Baum-Welch algorithm
General idea:
sj to state si
Expected number of transitions out of state sj
vm occurs in state si
Expected number of times in state si
si at time k=1.
oK .
k(i,j)= P(qk= si , qk+1= sj | o1 o2 ... oK)
k(i,j)=
k(i)=
oK .
k(i) k(i)
i k(i) k(i)
k k(i,j)
1(i) .
sj to
bi(vm ) =
state
sj
si
vm occurs in state si
Expected number of times in state si
k k(i,j)
k k(i)
k k(i,j)
=
k,o = v k(i)