84
CS 5522: Artificial Intelligence II Hidden Markov Models Instructor: Alan Ritter Ohio State University [These slides were adapted from CS188 Intro to AI at UC Berkeley. All materials available at http://ai.berkeley.edu.]

Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

CS 5522: Artificial Intelligence II Hidden Markov Models

Instructor: Alan Ritter

Ohio State University [These slides were adapted from CS188 Intro to AI at UC Berkeley. All materials available at http://ai.berkeley.edu.]

Page 2: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Pacman – Sonar (P4)

[Demo: Pacman – Sonar – No Beliefs(L14D1)]

Page 3: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Video of Demo Pacman – Sonar (no beliefs)

Page 4: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Video of Demo Pacman – Sonar (no beliefs)

Page 5: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Video of Demo Pacman – Sonar (no beliefs)

Page 6: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

Page 7: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

▪ Conditional probability

Page 8: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

▪ Conditional probability

▪ Product rule

Page 9: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

▪ Conditional probability

▪ Product rule

▪ Chain rule

Page 10: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

▪ Conditional probability

▪ Product rule

▪ Chain rule

Page 11: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

▪ Conditional probability

▪ Product rule

▪ Chain rule

Page 12: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

▪ Conditional probability

▪ Product rule

▪ Chain rule

▪ X, Y independent if and only if:

Page 13: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

▪ Conditional probability

▪ Product rule

▪ Chain rule

▪ X, Y independent if and only if:

▪ X and Y are conditionally independent given Z if and only if:

Page 14: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

▪ Conditional probability

▪ Product rule

▪ Chain rule

▪ X, Y independent if and only if:

▪ X and Y are conditionally independent given Z if and only if:

Page 15: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

▪ Conditional probability

▪ Product rule

▪ Chain rule

▪ X, Y independent if and only if:

▪ X and Y are conditionally independent given Z if and only if:

Page 16: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Probability Recap

▪ Conditional probability

▪ Product rule

▪ Chain rule

▪ X, Y independent if and only if:

▪ X and Y are conditionally independent given Z if and only if:

Page 17: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Hidden Markov Models

Page 18: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Hidden Markov Models

▪ Markov chains not so useful for most agents ▪ Need observations to update your beliefs

▪ Hidden Markov models (HMMs) ▪ Underlying Markov chain over states X ▪ You observe outputs (effects) at each time step

X5X2

E1

X1 X3 X4

E2 E3 E4 E5

Page 19: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Weather HMM

Umbrellat-1 Umbrellat Umbrellat+1

Raint-1 Raint Raint+1

▪ An HMM is defined by: ▪ Initial distribution: ▪ Transitions: ▪ Emissions:

Page 20: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Weather HMM

Rt Rt+1 P(Rt+1|Rt)

+r +r 0.7

+r -r 0.3

-r +r 0.3

-r -r 0.7

Umbrellat-1 Umbrellat Umbrellat+1

Raint-1 Raint Raint+1

▪ An HMM is defined by: ▪ Initial distribution: ▪ Transitions: ▪ Emissions:

Page 21: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Weather HMM

Rt Rt+1 P(Rt+1|Rt)

+r +r 0.7

+r -r 0.3

-r +r 0.3

-r -r 0.7

Umbrellat-1

Rt Ut P(Ut|Rt)

+r +u 0.9

+r -u 0.1

-r +u 0.2

-r -u 0.8

Umbrellat Umbrellat+1

Raint-1 Raint Raint+1

▪ An HMM is defined by: ▪ Initial distribution: ▪ Transitions: ▪ Emissions:

Page 22: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Ghostbusters HMM

▪ P(X1) = uniform 1/9 1/9

1/9 1/9

1/9

1/9

1/9 1/9 1/9

P(X1)

[Demo: Ghostbusters – Circular Dynamics – HMM (L14D2)]

Page 23: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Ghostbusters HMM

▪ P(X1) = uniform

▪ P(X|X’) = usually move clockwise, but sometimes move in a random direction or stay in place

1/9 1/9

1/9 1/9

1/9

1/9

1/9 1/9 1/9

P(X1)

[Demo: Ghostbusters – Circular Dynamics – HMM (L14D2)]

Page 24: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Ghostbusters HMM

▪ P(X1) = uniform

▪ P(X|X’) = usually move clockwise, but sometimes move in a random direction or stay in place

1/9 1/9

1/9 1/9

1/9

1/9

1/9 1/9 1/9

P(X1)

P(X|X’=<1,2>)

1/6 1/6

0 1/6

1/2

0

0 0 0

[Demo: Ghostbusters – Circular Dynamics – HMM (L14D2)]

Page 25: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Ghostbusters HMM

▪ P(X1) = uniform

▪ P(X|X’) = usually move clockwise, but sometimes move in a random direction or stay in place

▪ P(Rij|X) = same sensor model as before: red means close, green means far away.

1/9 1/9

1/9 1/9

1/9

1/9

1/9 1/9 1/9

P(X1)

P(X|X’=<1,2>)

1/6 1/6

0 1/6

1/2

0

0 0 0

X5

X2

Ri,j

X1 X3 X4

Ri,j Ri,j Ri,j

[Demo: Ghostbusters – Circular Dynamics – HMM (L14D2)]

Page 26: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Video of Demo Ghostbusters – Circular Dynamics -- HMM

Page 27: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Video of Demo Ghostbusters – Circular Dynamics -- HMM

Page 28: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Video of Demo Ghostbusters – Circular Dynamics -- HMM

Page 29: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Joint Distribution of an HMM

▪ Joint distribution:

▪ More generally:

▪ Questions to be resolved: ▪ Does this indeed define a joint distribution? ▪ Can every joint distribution be factored this way, or are we making some assumptions

about the joint distribution by using this factorization?

X5X2

E1

X1 X3

E2 E3 E5

Page 30: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

▪ From the chain rule, every joint distribution over can be written as:

▪ Assuming that

gives us the expression posited on the previous slide:

X2

E1

X1 X3

E2 E3

Chain Rule and HMMs

Page 31: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Chain Rule and HMMs

▪ From the chain rule, every joint distribution over can be written as:

▪ Assuming that for all t: ▪ State independent of all past states and all past evidence given the previous state, i.e.:

▪ Evidence is independent of all past states and all past evidence given the current state, i.e.:

gives us the expression posited on the earlier slide:

X2

E1

X1 X3

E2 E3

Page 32: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Implied Conditional Independencies

▪ Many implied conditional independencies, e.g.,

▪ To prove them ▪ Approach 1: follow similar (algebraic) approach to what we did in the Markov

models lecture ▪ Approach 2: directly from the graph structure (3 lectures from now)

▪ Intuition: If path between U and V goes through W, then

X2

E1

X1 X3

E2 E3

[Some fineprint later]

Page 33: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Real HMM Examples

▪ Speech recognition HMMs: ▪ Observations are acoustic signals (continuous valued) ▪ States are specific positions in specific words (so, tens of thousands)

▪ Machine translation HMMs: ▪ Observations are words (tens of thousands) ▪ States are translation options

▪ Robot tracking: ▪ Observations are range readings (continuous) ▪ States are positions on a map (continuous)

Page 34: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Filtering / Monitoring

▪ Filtering, or monitoring, is the task of tracking the distribution Bt(X) = Pt(Xt | e1, …, et) (the belief state) over time

▪ We start with B1(X) in an initial setting, usually uniform

▪ As time passes, or we get observations, we update B(X)

▪ The Kalman filter was invented in the 60’s and first implemented as a method of trajectory estimation for the Apollo program

Page 35: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Robot Localization

t=0 Sensor model: can read in which directions there is a wall, never

more than 1 mistake Motion model: may not execute action with small prob.

10Prob

Example from Michael Pfeiffer

Page 36: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Robot Localization

t=1 Lighter grey: was possible to get the reading, but less likely

b/c required 1 mistake

10Prob

Page 37: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Robot Localization

t=1 Lighter grey: was possible to get the reading, but less likely

b/c required 1 mistake

10Prob

Page 38: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Robot Localization

t=2

10Prob

Page 39: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Robot Localization

t=2

10Prob

Page 40: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Robot Localization

t=3

10Prob

Page 41: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Robot Localization

t=3

10Prob

Page 42: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Robot Localization

t=4

10Prob

Page 43: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Robot Localization

t=4

10Prob

Page 44: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Robot Localization

t=5

10Prob

Page 45: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Inference: Base Cases

E1

X1

Page 46: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Inference: Base Cases

E1

X1

Page 47: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Inference: Base Cases

E1

X1

X2X1

Page 48: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Inference: Base Cases

E1

X1

X2X1

Page 49: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Passage of Time

▪ Assume we have current belief P(X | evidence to date)X2X1

Page 50: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Passage of Time

▪ Assume we have current belief P(X | evidence to date)

▪ Then, after one time step passes:

X2X1

Page 51: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Passage of Time

▪ Assume we have current belief P(X | evidence to date)

▪ Then, after one time step passes:

X2X1

Page 52: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Passage of Time

▪ Assume we have current belief P(X | evidence to date)

▪ Then, after one time step passes:

X2X1

Page 53: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Passage of Time

▪ Assume we have current belief P(X | evidence to date)

▪ Then, after one time step passes:

X2X1

Page 54: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Passage of Time

▪ Assume we have current belief P(X | evidence to date)

▪ Then, after one time step passes:

X2X1

Page 55: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Passage of Time

▪ Assume we have current belief P(X | evidence to date)

▪ Then, after one time step passes:

X2X1

▪ Or compactly:

Page 56: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Passage of Time

▪ Assume we have current belief P(X | evidence to date)

▪ Then, after one time step passes:

▪ Basic idea: beliefs get “pushed” through the transitions▪ With the “B” notation, we have to be careful about what time step t the belief is about, and

what evidence it includes

X2X1

▪ Or compactly:

Page 57: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Passage of Time

▪ As time passes, uncertainty “accumulates”

T = 1

(Transition model: ghosts usually go clockwise)

Page 58: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Passage of Time

▪ As time passes, uncertainty “accumulates”

T = 1 T = 2

(Transition model: ghosts usually go clockwise)

Page 59: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Passage of Time

▪ As time passes, uncertainty “accumulates”

T = 1 T = 2 T = 5

(Transition model: ghosts usually go clockwise)

Page 60: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Passage of Time

▪ As time passes, uncertainty “accumulates”

T = 1 T = 2 T = 5

(Transition model: ghosts usually go clockwise)

Page 61: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Observation▪ Assume we have current belief P(X | previous evidence):

E1

X1

Page 62: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Observation▪ Assume we have current belief P(X | previous evidence):

▪ Then, after evidence comes in: E1

X1

Page 63: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Observation▪ Assume we have current belief P(X | previous evidence):

▪ Then, after evidence comes in: E1

X1

Page 64: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Observation▪ Assume we have current belief P(X | previous evidence):

▪ Then, after evidence comes in: E1

X1

Page 65: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Observation▪ Assume we have current belief P(X | previous evidence):

▪ Then, after evidence comes in: E1

X1

Page 66: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Observation▪ Assume we have current belief P(X | previous evidence):

▪ Then, after evidence comes in: E1

X1

Page 67: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Observation▪ Assume we have current belief P(X | previous evidence):

▪ Then, after evidence comes in: E1

X1

Page 68: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Observation▪ Assume we have current belief P(X | previous evidence):

▪ Then, after evidence comes in:

▪ Or, compactly:

E1

X1

Page 69: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Observation▪ Assume we have current belief P(X | previous evidence):

▪ Then, after evidence comes in:

▪ Or, compactly:

E1

X1

Page 70: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Observation▪ Assume we have current belief P(X | previous evidence):

▪ Then, after evidence comes in:

▪ Or, compactly:

E1

X1

▪ Basic idea: beliefs “reweighted” by likelihood of evidence

▪ Unlike passage of time, we have to renormalize

Page 71: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Observation

▪ As we get observations, beliefs get reweighted, uncertainty “decreases”

Before observation After observation

Page 72: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Weather HMM

Umbrella1 Umbrella2

Rain0 Rain1 Rain2

B(+r) = 0.5 B(-r) = 0.5

B’(+r) = 0.5 B’(-r) = 0.5

B(+r) = 0.818 B(-r) = 0.182

B’(+r) = 0.627 B’(-r) = 0.373

B(+r) = 0.883 B(-r) = 0.117

Page 73: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Weather HMM

Rt Rt+1 P(Rt+1|Rt)

+r +r 0.7

+r -r 0.3

-r +r 0.3

-r -r 0.7

Umbrella1 Umbrella2

Rain0 Rain1 Rain2

B(+r) = 0.5 B(-r) = 0.5

B’(+r) = 0.5 B’(-r) = 0.5

B(+r) = 0.818 B(-r) = 0.182

B’(+r) = 0.627 B’(-r) = 0.373

B(+r) = 0.883 B(-r) = 0.117

Page 74: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Example: Weather HMM

Rt Rt+1 P(Rt+1|Rt)

+r +r 0.7

+r -r 0.3

-r +r 0.3

-r -r 0.7

Rt Ut P(Ut|Rt)

+r +u 0.9

+r -u 0.1

-r +u 0.2

-r -u 0.8

Umbrella1 Umbrella2

Rain0 Rain1 Rain2

B(+r) = 0.5 B(-r) = 0.5

B’(+r) = 0.5 B’(-r) = 0.5

B(+r) = 0.818 B(-r) = 0.182

B’(+r) = 0.627 B’(-r) = 0.373

B(+r) = 0.883 B(-r) = 0.117

Page 75: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

The Forward Algorithm▪ We are given evidence at each time and want to know

▪ We can derive the following updatesWe can normalize as we go if we want to have P(x|e) at each time

step, or just once at the end…

Page 76: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

The Forward Algorithm▪ We are given evidence at each time and want to know

▪ We can derive the following updatesWe can normalize as we go if we want to have P(x|e) at each time

step, or just once at the end…

Page 77: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

The Forward Algorithm▪ We are given evidence at each time and want to know

▪ We can derive the following updatesWe can normalize as we go if we want to have P(x|e) at each time

step, or just once at the end…

Page 78: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

The Forward Algorithm▪ We are given evidence at each time and want to know

▪ We can derive the following updatesWe can normalize as we go if we want to have P(x|e) at each time

step, or just once at the end…

Page 79: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Online Belief Updates

▪ Every time step, we start with current P(X | evidence) ▪ We update for time:

▪ We update for evidence:

▪ The forward algorithm does both at once (and doesn’t normalize)

X2X1

X2

E2

Page 80: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Pacman – Sonar (P4)

[Demo: Pacman – Sonar – No Beliefs(L14D1)]

Page 81: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Video of Demo Pacman – Sonar (with beliefs)

Page 82: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Video of Demo Pacman – Sonar (with beliefs)

Page 83: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Video of Demo Pacman – Sonar (with beliefs)

Page 84: Hidden Markov Models - GitHub Pagesaritter.github.io/courses/5522_slides/hmm.pdfProbability Recap Conditional probability Product rule Chain rule X, Y independent if and only if: X

Next Time: Particle Filtering and Applications of HMMs