introduction to machine learning cmu 10701
play

Introduction to Machine Learning CMU-10701 Hidden Markov Models - PowerPoint PPT Presentation

Introduction to Machine Learning CMU-10701 Hidden Markov Models Barnabs Pczos & Aarti Singh Slides courtesy: Eric Xing i.i.d to sequential data So far we assumed independent, identically distributed data Sequential (non i.i.d.)


  1. Introduction to Machine Learning CMU-10701 Hidden Markov Models Barnabás Póczos & Aarti Singh Slides courtesy: Eric Xing

  2. i.i.d to sequential data  So far we assumed independent, identically distributed data  Sequential (non i.i.d.) data – Time-series data E.g. Speech – Characters in a sentence – Base pairs along a DNA strand 2

  3. Markov Models  Joint distribution of n arbitrary random variables Chain rule  Markov Assumption (m th order) Current observation only depends on past m observations 3

  4. Markov Models  Markov Assumption 1 st order 2 nd order 4

  5. Markov Models # parameters in stationary model  Markov Assumption K-ary variables O(K 2 ) 1 st order m th order O(K m+1 ) O(K n ) n-1 th order ≡ no assumptions – complete (but directed) graph Homogeneous/stationary Markov model (probabilities don’t depend on n) 5

  6. Hidden Markov Models • Distributions that characterize sequential data with few parameters but are not limited by strong Markov assumptions. S 1 S 2 S T-1 S T O 2 O T-1 O T O 1 Observation space O t ϵ {y 1 , y 2 , …, y K } S t ϵ {1, …, I } Hidden states 6

  7. Hidden Markov Models S 1 S 2 S T-1 S T O 2 O T-1 O 1 O T 1 st order Markov assumption on hidden states {S t } t = 1, …, T (can be extended to higher order). Note: O t depends on all previous observations {O t-1 ,…O 1 } 7

  8. Hidden Markov Models • Parameters – stationary/homogeneous markov model (independent of time t) S 1 S 2 S T-1 S T Initial probabilities p(S 1 = i) = π i O 2 O T-1 O T O 1 Transition probabilities p(S t = j|S t-1 = i) = p ij Emission probabilities p(O t = y|S t = i) = 8

  9. HMM Example • The Dishonest Casino A casino has two dices: Fair dice P(1) = P(2) = P(3) = P(5) = P(6) = 1/6 Loaded dice P(1) = P(2) = P(3) = P(5) = 1/10 P(6) = ½ Casino player switches back-&- forth between fair and loaded die with 5% probability 9

  10. HMM Problems 10

  11. HMM Example L F F F L L L F 11

  12. State Space Representation  Switch between F and L with 5% probability 0.05 0.95 0.95 L F 0.05  HMM Parameters Initial probs P(S 1 = L ) = 0.5 = P(S 1 = F ) Transition probs P(S t = L / F |S t-1 = L / F ) = 0.95 P(S t = F / L |S t-1 = L / F ) = 0.05 Emission probabilities P(O t = y|S t = F ) = 1/6 y = 1,2,3,4,5,6 P(O t = y|S t = L ) = 1/10 y = 1,2,3,4,5 = 1/2 y = 6 12

  13. Three main problems in HMMs • Evaluation – Given HMM parameters & observation seqn find prob of observed sequence • Decoding – Given HMM parameters & observation seqn find most probable sequence of hidden states • Learning – Given HMM with unknown parameters and observation sequence find parameters that maximize likelihood of observed data 13

  14. HMM Algorithms • Evaluation – What is the probability of the observed sequence? Forward Algorithm • Decoding – What is the probability that the third roll was loaded given the observed sequence? Forward-Backward Algorithm – What is the most likely die sequence given the observed sequence? Viterbi Algorithm • Learning – Under what parameterization is the observed sequence most probable? Baum-Welch Algorithm (EM) 14

  15. Evaluation Problem • Given HMM parameters & observation sequence S T-1 S 1 S 2 S T find probability of observed sequence O T-1 O T O 1 O 2 requires summing over all possible hidden state values at all times – K T exponential # terms! Instead: Compute recursively k α T 15

  16. Forward Probability k Compute forward probability recursively over t α t S t-1 S t S 1 O t-1 O t O 1 Introduce S t-1 . Chain rule . . Markov assumption 16

  17. Forward Algorithm k for all k, t using dynamic programming: Can compute α t k = p(O 1 |S 1 = k) p(S 1 = k) • Initialize: α 1 for all k • Iterate: for t = 2, …, T i k = p(O t |S t = k) ∑ α t-1 p(S t = k|S t-1 = i) for all k α t i k • Termination: = ∑ α T k 17

  18. Decoding Problem 1 • Given HMM parameters & observation sequence find probability that hidden state at time t was k Compute recursively k k β t α t S t-1 S t S t+1 S 1 S T-1 S T O t-1 O t O t+1 O 1 O T-1 O T 18

  19. Backward Probability k Compute forward probability recursively over t β t S t S t+1 S t+2 S T O t O t+1 O t+2 O T Introduce S t+1 . Chain rule . . Markov assumption 19

  20. Backward Algorithm k for all k, t using dynamic programming: Can compute β t k = 1 • Initialize: β T for all k • Iterate: for t = T-1, …, 1 for all k • Termination: 20

  21. Most likely state vs. Most likely sequence  Most likely state assignment at time t E.g. Which die was most likely used by the casino in the third roll given the observed sequence?  Most likely assignment of state sequence E.g. What was the most likely sequence of die rolls used by the casino given the observed sequence? MLA of x? Not the same solution ! MLA of (x,y)? 21

  22. Decoding Problem 2 • Given HMM parameters & observation sequence find most likely assignment of state sequence k V T Compute recursively k V T - probability of most likely sequence of states ending at state S T = k 22

  23. Viterbi Decoding k V t Compute probability recursively over t S t-1 S t S 1 Bayes rule . . O t-1 O t O 1 Markov assumption . 23

  24. Viterbi Algorithm k for all k, t using dynamic programming: Can compute V t k = p(O 1 |S 1 =k)p(S 1 = k) • Initialize: V 1 for all k • Iterate: for t = 2, …, T for all k • Termination: Traceback: 24

  25. Computational complexity • What is the running time for Forward, Backward, Viterbi? O(K 2 T) linear in T instead of O(K T ) exponential in T! 25

  26. Learning Problem • Given HMM with unknown parameters and observation sequence find parameters that maximize likelihood of observed data But likelihood doesn’t factorize since observations not i.i.d. hidden variables – state sequence EM (Baum-Welch) Algorithm: E-step – Fix parameters, find expected state assignments M-step – Fix expected state assignments, update parameters 26

  27. Baum-Welch (EM) Algorithm • Start with random initialization of parameters • E-step – Fix parameters, find expected state assignments Forward-Backward algorithm 27

  28. Baum-Welch (EM) Algorithm • Start with random initialization of parameters • E-step = expected # times in state i -1 = expected # transitions from state i = expected # transitions from state i to j • M-step 28

  29. Some connections • HMM vs Linear Dynamical Systems (Kalman Filters) HMM: States are Discrete Observations Discrete or Continuous Linear Dynamical Systems: Observations and States are multi- variate Gaussians whose means are linear functions of their parent states (see Bishop: Sec 13.3) 29

  30. HMMs.. What you should know • Useful for modeling sequential data with few parameters using discrete hidden states that satisfy Markov assumption • Representation - initial prob, transition prob, emission prob, State space representation • Algorithms for inference and learning in HMMs – Computing marginal likelihood of the observed sequence: forward algorithm – Predicting a single hidden state: forward-backward – Predicting an entire sequence of hidden states: viterbi – Learning HMM parameters: an EM algorithm known as Baum- Welch 30

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend