hmm particle filters
play

HMM: Particle filters Lirong Xia Recap: Reasoning over Time Markov - PowerPoint PPT Presentation

HMM: Particle filters Lirong Xia Recap: Reasoning over Time Markov models p( X 1 ) p( X|X -1 ) Hidden Markov models p(E |X ) X E p rain umbrella 0.9 rain no umbrella 0.1 sun umbrella 0.2 sun no umbrella 0.8


  1. HMM: Particle filters Lirong Xia

  2. Recap: Reasoning over Time Ø Markov models p( X 1 ) p( X|X -1 ) • Hidden Markov models p(E |X ) X E p rain umbrella 0.9 rain no umbrella 0.1 sun umbrella 0.2 sun no umbrella 0.8 • Filtering: Given time t and evidences e 1 ,…,e t , compute p(X t |e 1:t ) 2

  3. Filtering algorithm Ø Notation • B(X t-1 )=p(X t-1 |e 1:t-1 ) • B’(X t )=p(X t |e 1:t-1 ) Ø Each time step, we start with p(X t-1 | previous evidence): Ø Elapse of time B’(X t )= Σ x t-1 p(X t |x t-1 )B(x t-1 ) Ø Observe B(X t ) ∝ p(e t |X t )B’(X t ) Ø Renormalize B(X t ) 3

  4. Today Ø Particle filtering Ø Viterbi algorithm 4

  5. Particle Filtering Ø 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 Ø This is how robot localization works in practice 5

  6. Representation: Particles Ø p(X) is now represented by 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: particles with value x (3,3) (2,3) • Many x will have p(x)=0 (3,3) • More particles, more accuracy (3,2) (3,3) (3,2) Ø For now, all particles have a (2,1) weight of 1 (3,3) (3,3) (2,1) 6

  7. Particle Filtering: Elapse Time Ø Each particle is moved by sampling its next position from the transition model x’= sample(p(X’|x)) • Samples’ frequencies reflect the transition probabilities Ø This captures the passage of time • If we have enough samples, close to the exact values before and after (consistent) 7

  8. Particle Filtering: Observe Ø Slightly trickier: • Likelihood weighting w x p e x | ( ) ( ) = B X p e X B | ' X ( ) ( ) ( ) ∝ • Note that, as before, the probabilities don’t sum to one, since most have been downweighted 8

  9. Particle Filtering: Resample Ø Rather than Old Particles: (3,3) w=0.1 tracking weighted (2,1) w=0.9 samples, we (2,1) w=0.9 resample (3,1) w=0.4 (3,2) w=0.3 Ø N times, we choose (2,2) w=0.4 from our weighted (1,1) w=0.4 (3,1) w=0.4 sample distribution (2,1) w=0.9 (i.e. draw with (3,2) w=0.3 replacement) New Particles: (2,1) w=1 Ø This is analogous to (2,1) w=1 renormalizing the (2,1) w=1 distribution (3,2) w=1 (2,2) w=1 (2,1) w=1 Ø Now the update is (1,1) w=1 complete for this (3,1) w=1 time step, continue (2,1) w=1 9 with the next one (1,1) w=1

  10. Forward algorithm vs. particle filtering Forward algorithm Particle filtering Ø Elapse of time • Elapse of time B’(X t )= Σ x t-1 p(X t |x t-1 )B(x t-1 ) x--->x’ • Observe Ø Observe w(x’)=p(e t |x) B(X t ) ∝ p(e t |X t )B’(X t ) • Resample Ø Renormalize resample N particles B(x t ) sum up to 1 10

  11. 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 11

  12. SLAM Ø SLAM = Simultaneous Localization And Mapping • We do not know the map or our location • Our belief state is over maps and positions! • Main techniques: • Kalman filtering (Gaussian HMMs) • particle methods • http://www.cs.duke.edu/~parr/dpslam/D-Wing.html 12

  13. HMMs: MLE Queries Ø HMMs defined by: • States X • Observations E • Initial distribution: p(X 1 ) • Transitions: p(X|X -1 ) • Emissions: p(E|X) Ø Query: most likely explanation: argmax p x | e ( ) 1: t 1: t x 1: t 13

  14. State Path Ø Graph of states and transitions over time X 1 X 2 … X N Ø Each arc represents some transition x t-1 →x t Ø Each arc has weight p(x t |x t-1 )p(e t |x t ) Ø Each path is a sequence of states Ø The product of weights on a path is the seq’s probability Ø Forward algorithm • computing the sum of all paths Ø Viterbi algorithm • computing the best paths 14

  15. Viterbi Algorithm * = argmax ( ) x 1: T p x 1: T | e 1: T x 1: T ( ) ! " # m t x t $ = max x 1: t − 1 p x 1: t − 1 , x t , e 1: t ( ) p x t | x t − 1 ( ) p e t | x t ( ) = max x 1: t − 1 p x 1: t − 1 , e 1: t − 1 ( ) max ( ) max ( ) = p e t | x t x t − 1 p x t | x t − 1 x 1: t − 2 p x 1: t − 1 , e 1: t − 1 ( ) max ( ) m t − 1 x t − 1 ! # = p e t | x t x t − 1 p x t | x t − 1 15 " $

  16. X E p Example +r +u 0.9 +r -u 0.1 -r +u 0.2 -r -u 0.8 16

Recommend


More recommend