Hidden Markov Models Markov chains not so useful for most agents

Slides:



Advertisements
Similar presentations
State Estimation and Kalman Filtering CS B659 Spring 2013 Kris Hauser.
Advertisements

Lirong Xia Probabilistic reasoning over time Tue, March 25, 2014.
Lirong Xia Hidden Markov Models Tue, March 28, 2014.
Lirong Xia Approximate inference: Particle filter Tue, April 1, 2014.
Hidden Markov Models Reading: Russell and Norvig, Chapter 15, Sections
Lab 2 Lab 3 Homework Labs 4-6 Final Project Late No Videos Write up
Advanced Artificial Intelligence
Bayes Filters Pieter Abbeel UC Berkeley EECS Many slides adapted from Thrun, Burgard and Fox, Probabilistic Robotics TexPoint fonts used in EMF. Read the.
QUIZ!!  T/F: Rejection Sampling without weighting is not consistent. FALSE  T/F: Rejection Sampling (often) converges faster than Forward Sampling. FALSE.
HMMs Tamara Berg CS Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew.
CS 188: Artificial Intelligence Fall 2009 Lecture 20: Particle Filtering 11/5/2009 Dan Klein – UC Berkeley TexPoint fonts used in EMF. Read the TexPoint.
Particle Filters Pieter Abbeel UC Berkeley EECS Many slides adapted from Thrun, Burgard and Fox, Probabilistic Robotics TexPoint fonts used in EMF. Read.
Announcements Homework 8 is out Final Contest (Optional)
CS 188: Artificial Intelligence Fall 2009 Lecture 19: Hidden Markov Models 11/3/2009 Dan Klein – UC Berkeley.
Particle Filtering. Sensors and Uncertainty Real world sensors are noisy and suffer from missing data (e.g., occlusions, GPS blackouts) Use sensor models.
CHAPTER 15 SECTION 3 – 4 Hidden Markov Models. Terminology.
QUIZ!!  T/F: The forward algorithm is really variable elimination, over time. TRUE  T/F: Particle Filtering is really sampling, over time. TRUE  T/F:
Computer vision: models, learning and inference Chapter 19 Temporal models.
Lab 4 1.Get an image into a ROS node 2.Find all the orange pixels (suggest HSV) 3.Identify the midpoint of all the orange pixels 4.Explore the findContours.
Simultaneous Localization and Mapping Presented by Lihan He Apr. 21, 2006.
Recap: Reasoning Over Time  Stationary Markov models  Hidden Markov models X2X2 X1X1 X3X3 X4X4 rainsun X5X5 X2X2 E1E1 X1X1 X3X3 X4X4 E2E2 E3E3.
1 Robot Environment Interaction Environment perception provides information about the environment’s state, and it tends to increase the robot’s knowledge.
CS 188: Artificial Intelligence Fall 2008 Lecture 19: HMMs 11/4/2008 Dan Klein – UC Berkeley 1.
Announcements  Project 3 will be posted ASAP: hunting ghosts with sonar.
Bayes’ Nets: Sampling [These slides were created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley. All CS188 materials are available.
CS 416 Artificial Intelligence Lecture 17 Reasoning over Time Chapter 15 Lecture 17 Reasoning over Time Chapter 15.
CS Statistical Machine learning Lecture 24
QUIZ!!  In HMMs...  T/F:... the emissions are hidden. FALSE  T/F:... observations are independent given no evidence. FALSE  T/F:... each variable X.
Bayes Nets & HMMs Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell,
CS Statistical Machine learning Lecture 25 Yuan (Alan) Qi Purdue CS Nov
Reasoning over Time  Often, we want to reason about a sequence of observations  Speech recognition  Robot localization  User attention  Medical monitoring.
CSE 473: Artificial Intelligence Spring 2012 Reasoning about Uncertainty & Hidden Markov Models Daniel Weld Many slides adapted from Dan Klein, Stuart.
CSE 573: Artificial Intelligence Autumn 2012 Particle Filters for Hidden Markov Models Daniel Weld Many slides adapted from Dan Klein, Stuart Russell,
Probabilistic Robotics Probability Theory Basics Error Propagation Slides from Autonomous Robots (Siegwart and Nourbaksh), Chapter 5 Probabilistic Robotics.
Autonomous Mobile Robots Autonomous Systems Lab Zürich Probabilistic Map Based Localization "Position" Global Map PerceptionMotion Control Cognition Real.
General approach: A: action S: pose O: observation Position at time t depends on position previous position and action, and current observation.
CS 541: Artificial Intelligence Lecture VIII: Temporal Probability Models.
HMM: Particle filters Lirong Xia. HMM: Particle filters Lirong Xia.
Probabilistic reasoning over time
Probabilistic Reasoning
Probabilistic Robotics
Artificial Intelligence
Markov ó Kalman Filter Localization
CS 4/527: Artificial Intelligence
Introduction to particle filter
CAP 5636 – Advanced Artificial Intelligence
Probabilistic Reasoning over Time
Probabilistic Reasoning over Time
Probabilistic Reasoning
CS 188: Artificial Intelligence Spring 2007
Probability Topics Random Variables Joint and Marginal Distributions
Introduction to particle filter
CS 188: Artificial Intelligence
Probabilistic Reasoning
Particle Filtering.
Probabilistic Reasoning
Motion Models (cont) 2/16/2019.
Probabilistic Map Based Localization
CS 188: Artificial Intelligence Fall 2008
Hidden Markov Models Lirong Xia.
Principle of Bayesian Robot Localization.
Non-parametric Filters: Particle Filters
Speech recognition, machine learning
Announcements Assignments HW10 Due Wed 4/17 HW11
Non-parametric Filters: Particle Filters
HMM: Particle filters Lirong Xia. HMM: Particle filters Lirong Xia.
Probabilistic reasoning over time
Probabilistic Robotics Bayes Filter Implementations FastSLAM
Speech recognition, machine learning
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 14
Presentation transcript:

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 X1 X2 X3 X4 X5 E1 E2 E3 E4 E5

Example: Weather HMM An HMM is defined by: Initial distribution: Raint-1 Raint Raint+1 Rt Rt+1 P(Rt+1|Rt) +r 0.7 -r 0.3 Umbrellat-1 Umbrellat Umbrellat+1 demo An HMM is defined by: Initial distribution: Transitions: Emissions: Rt Ut P(Ut|Rt) +r +u 0.9 -u 0.1 -r 0.2 0.8 also called evidence

The evidence is something new we observe at each time step.

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. initial probabilities that ghost is in a square 1/9 specified by a distribution P(X1) Dan has some demo for this. 1/6 1/2 Rij are responses or evidence observed at each step. X1 X2 X3 X4 X5 P(X|X’=<1,2>) Ri,j Ri,j Ri,j Ri,j

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)

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 Dan has some demo for this

Example: Robot Localization Example from Michael Pfeiffer Prob 1 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.

Example: Robot Localization Prob 1 t=1 Lighter grey: was possible to get the reading, but less likely b/c required 1 mistake

Example: Robot Localization Prob 1 t=2

Example: Robot Localization Prob 1 t=3

Example: Robot Localization Prob 1 t=4

Example: Robot Localization Prob 1 t=5

Inference: Base Cases EVIDENCE TRANSITION X1 X1 X2 E1 proportional to

1 over all possible states that xt-1 can be 2 new evidence et

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 X2 X1 TODO: intermediate step in derivation! Or compactly: STEP 1

Example: Passage of Time As time passes, uncertainty “accumulates” T = 1 T = 2 T = 5 (Transition model: ghosts usually go clockwise)

Observation X1 Assume we have current belief P(X | previous evidence): Then, after evidence comes in: Or, compactly: Basic idea: beliefs “reweighted” by likelihood of evidence Unlike passage of time, we have to renormalize Basic idea: beliefs “reweighted” by likelihood of evidence Unlike passage of time, we have to renormalize STEP 2

Example: Observation As we get observations, beliefs get reweighted, uncertainty “decreases” Before observation After observation

Example: Weather HMM update using transition probabilities Rt Rt+1 P(Rt+1|Rt) +r 0.7 -r 0.3 B’(+r) = 0.5 B’(-r) = 0.5 B’(+r) = 0.627 B’(-r) = 0.373 update using evidence probabilities 4 2 3 B(+r) = 0.5 B(-r) = 0.5 B(+r) = 0.818 B(-r) = 0.182 B(+r) = 0.883 B(-r) = 0.117 1 demo Rain0 Rain1 Rain2 Rt Ut P(Ut|Rt) +r +u 0.9 -u 0.1 -r 0.2 0.8 Umbrella1 Umbrella2

The Forward Algorithm We are given evidence at each time and want to know Step 1: Update for time Step 2: Update for evidence Step 2’: Normalize (Given un-normalized p1 and p2, convert to p1/(p1+p2) and p2/(p1+p2). TODO: explain propto and it’s X_t, not X

Particle Filters and Applications of HMMs Please retain proper attribution, including the reference to ai.berkeley.edu. Thanks! [These slides were created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley. All CS188 materials are available at http://ai.berkeley.edu.]

Particle Filtering

Particle Filtering Filtering: approximate solution Sometimes |X| is too big to use exact inference |X| may be too big to even store B(X) E.g. X is continuous Solution: approximate inference Track samples of X, not all values Samples are called particles Time per step is linear in the number of samples But: number needed may be large In memory: list of particles, not states This is how robot localization works in practice Particle is just new name for sample 0.0 0.1 0.2 0.5

Representation: Particles Our representation of P(X) is now a list of N particles (samples) Generally, N << |X| Storing map from X to counts would defeat the point P(x) approximated by (number of particles with value x)/N So, many x may have P(x) = 0 More particles, more accuracy What is P((3,3)) 5/10 = .5 or 50% What is P((2,2)) 0/10 = 0 3 2 1 1 2 3 Particles: (3,3) (2,3) (3,2) (1,2)

Particle Filtering: Elapse Time Each particle is moved by sampling its next position from the transition model This is like prior sampling – samples’ frequencies reflect the transition probabilities Here, most samples move clockwise, but some move in another direction or stay in place This captures the passage of time If enough samples, close to exact values before and after (consistent) Particles: (3,3) (2,3) (3,2) (1,2) 3 2 1 1 2 3 Particles: (3,2) (2,3) (3,1) (3,3) (1,3) (2,2)

Particle Filtering: Observe Particles: (3,2) (2,3) (3,1) (3,3) (1,3) (2,2) Slightly trickier: Don’t sample observation, fix it Similar to likelihood weighting, downweight samples based on the evidence As before, the probabilities don’t sum to one, since all have been downweighted (in fact they now sum to (N times) an approximation of P(e)) comes from the evidence; just given here. Particles: (3,2) w=.9 (2,3) w=.2 (3,1) w=.4 (3,3) w=.4 (1,3) w=.1 (2,2) w=.4

Particle Filtering: Resample Rather than tracking weighted samples, we resample N times, we choose from our weighted sample distribution (i.e. draw with replacement) This is equivalent to renormalizing the distribution Now the update is complete for this time step, continue with the next one Particles: (3,2) w=.9 (2,3) w=.2 (3,1) w=.4 (3,3) w=.4 (1,3) w=.1 (2,2) w=.4 (New) Particles: (3,2) (2,2) (2,3) (3,3) (1,3) Why did the green particle get chosen twice?

Recap: Particle Filtering Particles: track samples of states rather than an explicit distribution Elapse Weight Resample Particles: (3,3) (2,3) (3,2) (1,2) Particles: (3,2) (2,3) (3,1) (3,3) (1,3) (2,2) Particles: (3,2) w=.9 (2,3) w=.2 (3,1) w=.4 (3,3) w=.4 (1,3) w=.1 (2,2) w=.4 (New) Particles: (3,2) (2,2) (2,3) (3,3) (1,3)

Robot Localization In robot localization: We know the map, but not the robot’s position Observations may be vectors of range finder readings State space and readings are typically continuous (works basically like a very fine grid) and so we cannot store B(X) Particle filtering is a main technique

Particle Filter Localization (Sonar) [Video: global-sonar-uw-annotated.avi]

Particle Filter Localization (Laser) [Video: global-floor.gif]

Robot Mapping SLAM: Simultaneous Localization And Mapping We do not know the map or our location State consists of position AND map! Main techniques: Kalman filtering (Gaussian HMMs) and particle methods DP-SLAM, Ron Parr [Demo: PARTICLES-SLAM-mapping1-new.avi]

Particle Filter SLAM – Video 1 [Demo: PARTICLES-SLAM-mapping1-new.avi]

Particle Filter SLAM – Video 2 [Demo: PARTICLES-SLAM-fastslam.avi]

Use of Particle Filtering in Tracking an Endoscope t = 10 t = 28 t = 35 t = 46 t = 54 particles are pink, actual location of endoscope blue