Hidden Markov Models David Meir Blei November 1, 1999.

33
Hidden Markov Models David Meir Blei November 1, 1999
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    224
  • download

    1

Transcript of Hidden Markov Models David Meir Blei November 1, 1999.

Page 1: Hidden Markov Models David Meir Blei November 1, 1999.

Hidden Markov Models

David Meir BleiNovember 1, 1999

Page 2: Hidden Markov Models David Meir Blei November 1, 1999.

What is an HMM?

• Graphical Model• Circles indicate states• Arrows indicate probabilistic dependencies

between states

Page 3: Hidden Markov Models David Meir Blei November 1, 1999.

What is an HMM?

• Green circles are hidden states• Dependent only on the previous state• “The past is independent of the future given the

present.”

Page 4: Hidden Markov Models David Meir Blei November 1, 1999.

What is an HMM?

• Purple nodes are observed states• Dependent only on their corresponding hidden

state

Page 5: Hidden Markov Models David Meir Blei November 1, 1999.

HMM Formalism

• {S, K, • S : {s1…sN } are the values for the hidden states

• K : {k1…kM } are the values for the observations

SSS

KKK

S

K

S

K

Page 6: Hidden Markov Models David Meir Blei November 1, 1999.

HMM Formalism

• {S, K, • are the initial state probabilities

• A = {aij} are the state transition probabilities

• B = {bik} are the observation state probabilities

A

B

AAA

BB

SSS

KKK

S

K

S

K

Page 7: Hidden Markov Models David Meir Blei November 1, 1999.

Inference in an HMM

• Compute the probability of a given observation sequence

• Given an observation sequence, compute the most likely hidden state sequence

• Given an observation sequence and set of possible models, which model most closely fits the data?

Page 8: Hidden Markov Models David Meir Blei November 1, 1999.

)|( Compute

),,( ,)...( 1

OP

BAooO T

oTo1 otot-1 ot+1

Given an observation sequence and a model, compute the probability of the observation sequence

Decoding

Page 9: Hidden Markov Models David Meir Blei November 1, 1999.

Decoding

TT oxoxox bbbXOP ...),|(2211

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Page 10: Hidden Markov Models David Meir Blei November 1, 1999.

Decoding

TT oxoxox bbbXOP ...),|(2211

TT xxxxxxx aaaXP132211

...)|(

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Page 11: Hidden Markov Models David Meir Blei November 1, 1999.

Decoding

)|(),|()|,( XPXOPXOP

TT oxoxox bbbXOP ...),|(2211

TT xxxxxxx aaaXP132211

...)|(

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Page 12: Hidden Markov Models David Meir Blei November 1, 1999.

Decoding

)|(),|()|,( XPXOPXOP

TT oxoxox bbbXOP ...),|(2211

TT xxxxxxx aaaXP132211

...)|(

X

XPXOPOP )|(),|()|(

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Page 13: Hidden Markov Models David Meir Blei November 1, 1999.

111

1

111

1

1}...{

)|(

tttt

T

oxxx

T

txxoxx babOP

Decoding

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Page 14: Hidden Markov Models David Meir Blei November 1, 1999.

)|,...()( 1 ixooPt tti

Forward Procedure

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

• Special structure gives us an efficient solution using dynamic programming.

• Intuition: Probability of the first t observations is the same for all possible t+1 length state sequences.

• Define:

Page 15: Hidden Markov Models David Meir Blei November 1, 1999.

)|(),...(

)()|()|...(

)()|...(

),...(

1111

11111

1111

111

jxoPjxooP

jxPjxoPjxooP

jxPjxooP

jxooP

tttt

ttttt

ttt

tt

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Forward Procedure

)1( tj

Page 16: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Forward Procedure

)1( tj

)|(),...(

)()|()|...(

)()|...(

),...(

1111

11111

1111

111

jxoPjxooP

jxPjxoPjxooP

jxPjxooP

jxooP

tttt

ttttt

ttt

tt

Page 17: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Forward Procedure

)1( tj

)|(),...(

)()|()|...(

)()|...(

),...(

1111

11111

1111

111

jxoPjxooP

jxPjxoPjxooP

jxPjxooP

jxooP

tttt

ttttt

ttt

tt

Page 18: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Forward Procedure

)1( tj

)|(),...(

)()|()|...(

)()|...(

),...(

1111

11111

1111

111

jxoPjxooP

jxPjxoPjxooP

jxPjxooP

jxooP

tttt

ttttt

ttt

tt

Page 19: Hidden Markov Models David Meir Blei November 1, 1999.

Nijoiji

ttttNi

tt

tttNi

ttt

ttNi

ttt

tbat

jxoPixjxPixooP

jxoPixPixjxooP

jxoPjxixooP

...1

111...1

1

11...1

11

11...1

11

1)(

)|()|(),...(

)|()()|,...(

)|(),,...(

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Forward Procedure

Page 20: Hidden Markov Models David Meir Blei November 1, 1999.

Nijoiji

ttttNi

tt

tttNi

ttt

ttNi

ttt

tbat

jxoPixjxPixooP

jxoPixPixjxooP

jxoPjxixooP

...1

111...1

1

11...1

11

11...1

11

1)(

)|()|(),...(

)|()()|,...(

)|(),,...(

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Forward Procedure

Page 21: Hidden Markov Models David Meir Blei November 1, 1999.

Nijoiji

ttttNi

tt

tttNi

ttt

ttNi

ttt

tbat

jxoPixjxPixooP

jxoPixPixjxooP

jxoPjxixooP

...1

111...1

1

11...1

11

11...1

11

1)(

)|()|(),...(

)|()()|,...(

)|(),,...(

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Forward Procedure

Page 22: Hidden Markov Models David Meir Blei November 1, 1999.

Nijoiji

ttttNi

tt

tttNi

ttt

ttNi

ttt

tbat

jxoPixjxPixooP

jxoPixPixjxooP

jxoPjxixooP

...1

111...1

1

11...1

11

11...1

11

1)(

)|()|(),...(

)|()()|,...(

)|(),,...(

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Forward Procedure

Page 23: Hidden Markov Models David Meir Blei November 1, 1999.

)|...()( ixooPt tTti

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Backward Procedure

1)1( Ti

Nj

jioiji tbatt

...1

)1()(

Probability of the rest of the states given the first state

Page 24: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

x1 xt+1 xTxtxt-1

Decoding Solution

N

ii TOP

1

)()|(

N

iiiOP

1

)1()|(

)()()|(1

ttOP i

N

ii

Forward Procedure

Backward Procedure

Combination

Page 25: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

Best State Sequence

• Find the state sequence that best explains the observations

• Viterbi algorithm

• )|(maxarg OXPX

Page 26: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

Viterbi Algorithm

),,...,...(max)( 1111... 11

ttttxx

j ojxooxxPtt

The state sequence which maximizes the probability of seeing the observations to time t-1, landing in state j, and seeing the observation at time t

x1 xt-1 j

Page 27: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

Viterbi Algorithm

),,...,...(max)( 1111... 11

ttttxx

j ojxooxxPtt

1)(max)1(

tjoijii

j batt

1)(maxarg)1(

tjoijii

j batt Recursive Computation

x1 xt-1 xt xt+1

Page 28: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

Viterbi Algorithm

)(maxargˆ TX ii

T

)1(ˆ1

^

tXtX

t

)(maxarg)ˆ( TXP ii

Compute the most likely state sequence by working backwards

x1 xt-1 xt xt+1 xT

Page 29: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

Parameter Estimation

• Given an observation sequence, find the model that is most likely to produce that sequence.

• No analytic method• Given a model and observation sequence, update

the model parameters to better fit the observations.

A

B

AAA

BBB B

Page 30: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

Parameter Estimation

A

B

AAA

BBB B

Nmmm

jjoijit tt

tbatjip t

...1

)()(

)1()(),( 1

Probability of traversing an arc

Nj

ti jipt...1

),()( Probability of being in state i

Page 31: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

Parameter Estimation

A

B

AAA

BBB B

)1(ˆ i i

Now we can compute the new estimates of the model parameters.

T

t i

T

t tij

t

jipa

1

1

)(

),(ˆ

T

t i

kot t

ikt

ib t

1

}:{

)(

)(ˆ

Page 32: Hidden Markov Models David Meir Blei November 1, 1999.

HMM Applications

• Generating parameters for n-gram models• Tagging speech• Speech recognition

Page 33: Hidden Markov Models David Meir Blei November 1, 1999.

oTo1 otot-1 ot+1

The Most Important Thing

A

B

AAA

BBB B

We can use the special structure of this model to do a lot of neat math and solve problems that are otherwise not solvable.