CS325 Artificial Intelligence Ch. 15,20 Hidden Markov Models and - - PowerPoint PPT Presentation

cs325 artificial intelligence ch 15 20 hidden markov
SMART_READER_LITE
LIVE PREVIEW

CS325 Artificial Intelligence Ch. 15,20 Hidden Markov Models and - - PowerPoint PPT Presentation

CS325 Artificial Intelligence Ch. 15,20 Hidden Markov Models and Particle Filtering Cengiz Gnay, Emory Univ. Gnay Ch. 15,20 Hidden Markov Models and Particle Filtering Spring 2013 1 / 21 Get Rich Fast! Gnay Ch. 15,20


slide-1
SLIDE 1

CS325 Artificial Intelligence

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Cengiz Günay, Emory Univ.

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 1 / 21

slide-2
SLIDE 2

Get Rich Fast!

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 2 / 21

slide-3
SLIDE 3

Get Rich Fast!

Or go bankrupt?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 2 / 21

slide-4
SLIDE 4

Get Rich Fast!

Or go bankrupt? So, how can we predict time-series data?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 2 / 21

slide-5
SLIDE 5

Hidden Markov Models

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 3 / 21

slide-6
SLIDE 6

Hidden Markov Models

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 3 / 21

slide-7
SLIDE 7

Entry/Exit Surveys

Exit survey: Reinforcement Learning

What’s the difference between MDPs and Reinforcement Learning? What is the dilemma between exploration and exploitation?

Entry survey: Hidden Markov Models (0.25 points of final grade)

What previous algorithm would you use for time series prediction? What time series do you wish you could predict?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 4 / 21

slide-8
SLIDE 8

Time Series Prediction?

Have we done this before?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 5 / 21

slide-9
SLIDE 9

Time Series Prediction?

Have we done this before? Belief states with action schemas?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 5 / 21

slide-10
SLIDE 10

Time Series Prediction?

Have we done this before? Belief states with action schemas?

Not for continuous variables Goal-based

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 5 / 21

slide-11
SLIDE 11

Time Series Prediction?

Have we done this before? Belief states with action schemas?

Not for continuous variables Goal-based

MDPs and RL?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 5 / 21

slide-12
SLIDE 12

Time Series Prediction?

Have we done this before? Belief states with action schemas?

Not for continuous variables Goal-based

MDPs and RL?

Goal-based No time sequence

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 5 / 21

slide-13
SLIDE 13

Time Series Prediction with Hidden Markov Models (HMMs)

  • Dr. Thrun is very happy – HMMs are his specialty.

HMMs:

analyze & predict time series data can deal with noisy sensors

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 6 / 21

slide-14
SLIDE 14

Time Series Prediction with Hidden Markov Models (HMMs)

  • Dr. Thrun is very happy – HMMs are his specialty.

HMMs:

analyze & predict time series data can deal with noisy sensors

Example domains: finance (get rich fast!) robotics medical speech and language Alternatives: Recurrent neural networks (not probabilistic)

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 6 / 21

slide-15
SLIDE 15

What are HMMs?

Markov chain: Hidden states : S1 → S2 → · · · → Sn ↓ ↓ Measurements : Z1 · · · Zn

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 7 / 21

slide-16
SLIDE 16

What are HMMs?

Markov chain: Hidden states : S1 → S2 → · · · → Sn ↓ ↓ Measurements : Z1 · · · Zn It’s essentially a Bayes Net!

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 7 / 21

slide-17
SLIDE 17

What are HMMs?

Markov chain: Hidden states : S1 → S2 → · · · → Sn ↓ ↓ Measurements : Z1 · · · Zn It’s essentially a Bayes Net! Implementations: Kalman Filter (see Ch. 15) Particle Filter

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 7 / 21

slide-18
SLIDE 18

Video: Lost Robots, Speech Recognition

slide-19
SLIDE 19

Future Prediction with Markov Chains

Is tomorrow going to be Rainy or Sunny? R S 0.4 0.2 0.8 0.6

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 9 / 21

slide-20
SLIDE 20

Future Prediction with Markov Chains

Is tomorrow going to be Rainy or Sunny? R S 0.4 0.2 0.8 0.6 Start with “today is rainy”: P(R0) = 1, then P(S0) = 0

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 9 / 21

slide-21
SLIDE 21

Future Prediction with Markov Chains

Is tomorrow going to be Rainy or Sunny? R S 0.4 0.2 0.8 0.6 Start with “today is rainy”: P(R0) = 1, then P(S0) = 0 What’s P(S1) = ? P(S2) = ? P(S3) = ?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 9 / 21

slide-22
SLIDE 22

Future Prediction with Markov Chains

Is tomorrow going to be Rainy or Sunny? R S 0.4 0.2 0.8 0.6 Start with “today is rainy”: P(R0) = 1, then P(S0) = 0 What’s P(S1) = 0.4 P(S2) = ? P(S3) = ?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 9 / 21

slide-23
SLIDE 23

Future Prediction with Markov Chains

Is tomorrow going to be Rainy or Sunny? R S 0.4 0.2 0.8 0.6 Start with “today is rainy”: P(R0) = 1, then P(S0) = 0 What’s P(S1) = 0.4 P(S2) = 0.56 P(S3) = ?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 9 / 21

slide-24
SLIDE 24

Future Prediction with Markov Chains

Is tomorrow going to be Rainy or Sunny? R S 0.4 0.2 0.8 0.6 Start with “today is rainy”: P(R0) = 1, then P(S0) = 0 What’s P(S1) = 0.4 P(S2) = 0.56 P(S3) = 0.624

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 9 / 21

slide-25
SLIDE 25

Future Prediction with Markov Chains

Is tomorrow going to be Rainy or Sunny? R S 0.4 0.2 0.8 0.6 Start with “today is rainy”: P(R0) = 1, then P(S0) = 0 What’s P(S1) = 0.4 P(S2) = 0.56 P(S3) = 0.624 P(St+1) = 0.4 × P(Rt) + 0.8 × P(St)

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 9 / 21

slide-26
SLIDE 26

Back to the Future?

How far can we see into the future? P(A∞) =? Until it reaches a stationary state (or limit cycle)

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 10 / 21

slide-27
SLIDE 27

Back to the Future?

How far can we see into the future? P(A∞) =? Until it reaches a stationary state (or limit cycle) Use calculus: lim

t→∞ P(At+1) = P(At)

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 10 / 21

slide-28
SLIDE 28

Back to the Future?

How far can we see into the future? P(A∞) =? Until it reaches a stationary state (or limit cycle) Use calculus: lim

t→∞ P(At+1) = P(At)

R S 0.4 0.2 0.8 0.6 P(S∞) = ?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 10 / 21

slide-29
SLIDE 29

Back to the Future?

How far can we see into the future? P(A∞) =? Until it reaches a stationary state (or limit cycle) Use calculus: lim

t→∞ P(At+1) = P(At)

R S 0.4 0.2 0.8 0.6 P(S∞) = 2/3

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 10 / 21

slide-30
SLIDE 30

Back to the Future?

How far can we see into the future? P(A∞) =? Until it reaches a stationary state (or limit cycle) Use calculus: lim

t→∞ P(At+1) = P(At)

R S 0.4 0.2 0.8 0.6 P(S∞) = 2/3 lim

t→∞ P(St+1) = 0.4 × P(Rt) + 0.8 × P(St),

  • subst. x = P(St+1) = P(St) = 1 − P(Rt) = · · ·

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 10 / 21

slide-31
SLIDE 31

And How Do We Get The Transition Probabilities?

R S ? ? ? ? Observed sequence in Atlanta : RRSRRRSR Use Maximum Likelihood

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 11 / 21

slide-32
SLIDE 32

And How Do We Get The Transition Probabilities?

R S ? ? ? ? Observed sequence in Atlanta : RRSRRRSR Use Maximum Likelihood P(S|S) = ?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 11 / 21

slide-33
SLIDE 33

And How Do We Get The Transition Probabilities?

R S ? ? ? ? Observed sequence in Atlanta : RRSRRRSR Use Maximum Likelihood P(S|S) =

  • bserved transitions

total transitions from S = 0 2

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 11 / 21

slide-34
SLIDE 34

And How Do We Get The Transition Probabilities?

R S ? ? ? ? Observed sequence in Atlanta : RRSRRRSR Use Maximum Likelihood P(S|S) =

  • bserved transitions

total transitions from S = 0 2 P(R|S) = 2/2, P(S|R) = 2/5, P(R|R) = 3/5

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 11 / 21

slide-35
SLIDE 35

And How Do We Get The Transition Probabilities?

R S ? ? ? ? Observed sequence in Atlanta : RRSRRRSR Use Maximum Likelihood P(S|S) =

  • bserved transitions

total transitions from S = 0 2 P(R|S) = 2/2, P(S|R) = 2/5, P(R|R) = 3/5 Edge effects? P(S|S) = 0?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 11 / 21

slide-36
SLIDE 36

Overcoming Overfitting: Remember Laplacian Smoothing?

Observed sequence in Atlanta : RRSRRRSR Laplacian smoothing K = 1 P(S|S) =

  • bserved transitions

total transitions from S

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 12 / 21

slide-37
SLIDE 37

Overcoming Overfitting: Remember Laplacian Smoothing?

Observed sequence in Atlanta : RRSRRRSR Laplacian smoothing K = 1 P(S|S) =

  • bserved transitions + K

total transitions from S + N

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 12 / 21

slide-38
SLIDE 38

Overcoming Overfitting: Remember Laplacian Smoothing?

Observed sequence in Atlanta : RRSRRRSR Laplacian smoothing K = 1 P(S|S) =

  • bserved transitions + K

total transitions from S + N = 0 + 1 2 + 2 K, N selected such that 0 ≤ P ≤ 1.

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 12 / 21

slide-39
SLIDE 39

Where is Markov Hidden?

R H G S H G 0.4 0.2 0.8 0.6 0.4 0.6 0.9 0.1 Hidden: rainy or sunny Observe: happy or grumpy

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 13 / 21

slide-40
SLIDE 40

Where is Markov Hidden?

R H G S H G 0.4 0.2 0.8 0.6 0.4 0.6 0.9 0.1 Hidden: rainy or sunny Observe: happy or grumpy Initial conditions P(R0) = 1/2, P(S0) = 1/2 P(S1|H1) = ?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 13 / 21

slide-41
SLIDE 41

Where is Markov Hidden?

R H G S H G 0.4 0.2 0.8 0.6 0.4 0.6 0.9 0.1 Hidden: rainy or sunny Observe: happy or grumpy Initial conditions P(R0) = 1/2, P(S0) = 1/2 P(S1|H1) = P(H1|S1)P(S1) P(H1) Bayes rule!

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 13 / 21

slide-42
SLIDE 42

Congrats, Done with Prediction and State Estimation

What else can we do with HMMs? Localization of the lost robot Blindfolded person

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 14 / 21

slide-43
SLIDE 43

Congrats, Done with Prediction and State Estimation

What else can we do with HMMs? Localization of the lost robot Blindfolded person Video: Robot localization

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 14 / 21

slide-44
SLIDE 44

HMMs, Formally

Hidden states : S1 → S2 → · · · → Sn ↓ ↓ Measurements : Z1 · · · Zn Question: P(S1|S2) ⊥ P(Sn|S2) ?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 15 / 21

slide-45
SLIDE 45

HMMs, Formally

Hidden states : S1 → S2 → · · · → Sn ↓ ↓ Measurements : Z1 · · · Zn Question: P(S1|S2) ⊥ P(Sn|S2) Yes! Past and future are independent.

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 15 / 21

slide-46
SLIDE 46

HMMs, Formally

Hidden states : S1 → S2 → · · · → Sn ↓ ↓ Measurements : Z1 · · · Zn Question: P(S1|S2) ⊥ P(Sn|S2) Yes! Past and future are independent. HMM equations: State estimation: P(S1|Z1) = αP(Z1|S1)P(S1)

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 15 / 21

slide-47
SLIDE 47

HMMs, Formally

Hidden states : S1 → S2 → · · · → Sn ↓ ↓ Measurements : Z1 · · · Zn Question: P(S1|S2) ⊥ P(Sn|S2) Yes! Past and future are independent. HMM equations: State estimation: P(S1|Z1) = αP(Z1|S1)P(S1) Prediction: P(S2) =

S1 P(S2|S1)P(S1)

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 15 / 21

slide-48
SLIDE 48

HMMs for Localization Example

Robot knows map, but not location: use multiplication and convolution

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 16 / 21

slide-49
SLIDE 49

HMMs for Localization Example

Robot knows map, but not location: use multiplication and convolution

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 16 / 21

slide-50
SLIDE 50

HMMs for Localization Example

Robot knows map, but not location: use multiplication and convolution

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 16 / 21

slide-51
SLIDE 51

HMMs for Localization Example

Robot knows map, but not location: use multiplication and convolution

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 16 / 21

slide-52
SLIDE 52

HMMs for Localization Example

Robot knows map, but not location: use multiplication and convolution

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 16 / 21

slide-53
SLIDE 53

HMMs for Localization Example

Robot knows map, but not location: use multiplication and convolution

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 16 / 21

slide-54
SLIDE 54

Particle Filters: For Clean Water?

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 17 / 21

slide-55
SLIDE 55

Particle Filters: For Clean Water?

Nope, but same idea. Video: Robot localization with particle filters

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 17 / 21

slide-56
SLIDE 56

Particle Filters: For Clean Water?

Nope, but same idea. Video: Robot localization with particle filters Belief representation Points are hypotheses Particles survive if consistent with measurements Easy implementation!

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 17 / 21

slide-57
SLIDE 57

Localization with Particle Filters

Particle filtering: weights show likelihood; pick particles, shift, and repeat

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 18 / 21

slide-58
SLIDE 58

Localization with Particle Filters

Particle filtering: weights show likelihood; pick particles, shift, and repeat

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 18 / 21

slide-59
SLIDE 59

Localization with Particle Filters

Particle filtering: weights show likelihood; pick particles, shift, and repeat

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 18 / 21

slide-60
SLIDE 60

Localization with Particle Filters

Particle filtering: weights show likelihood; pick particles, shift, and repeat

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 18 / 21

slide-61
SLIDE 61

Localization with Particle Filters

Particle filtering: weights show likelihood; pick particles, shift, and repeat

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 18 / 21

slide-62
SLIDE 62

Localization with Particle Filters

Particle filtering: weights show likelihood; pick particles, shift, and repeat Continuous space! Computational resources used efficiently!

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 18 / 21

slide-63
SLIDE 63

Particle Filter Algorithm

S: Particle set {< x, w >, . . .}, U: Control vector (e.g., map), Z: Measure vector S′ = Ø, η = 0 For i=1. . . n sample j ∼ {w} w/ replacement x′ ∼ P(x′|U, Sj) w′ = P(Z|x′) η = η + w′ S′ = S′ ∪ {< x′, w′ >} End For i=1. . . n // Normalization step wi = 1

ηwi

End

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 19 / 21

slide-64
SLIDE 64

Particle Filter Pros & Cons

In general works well! Stanley uses it for navigation. Pros: Easy to implement Efficient Complex and changing environments in robotics Cons: Dimensionality problem: need many particles Problems with degenerate conditions (adding noise may help)

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 20 / 21

slide-65
SLIDE 65

Time Series Prediction Conclusion

Particle filtering: Most widely used algorithm! Can handle time series and uncertainty Other application areas: Financial prediction Weather Alternative methods: Kalman filters Recurrent neural nets

Günay

  • Ch. 15,20 – Hidden Markov Models and Particle Filtering

Spring 2013 21 / 21