Download presentation

Presentation is loading. Please wait.

Published byJack Waters Modified over 4 years ago

1
Lirong Xia Approximate inference: Particle filter Tue, April 1, 2014

2
Friday April 4 –Project 3 due –Project 4 (HMM) out 1 Reminder

3
Recap: Reasoning over Time 2 Markov models p(X 1 ) p(X|X -1 ) Hidden Markov models p(E|X) XEp rainumbrella0.9 rainno umbrella0.1 sunumbrella0.2 sunno umbrella0.8 Filtering: Given time t and evidences e 1,…,e t, compute p(X t |e 1:t )

4
Filtering algorithm 3 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 )

5
Prior Sampling (w/o evidences) 4 Given a Bayesian network (graph and CPTs) Generate values of random variables sequentially –According to an order compatible with the graph –In each step, generate the value of the top unvalued variable given previously generated values This sampling procedure is consistent Samples: +c, -s, +r, +w -c, +s, -r, +w

6
Rejection Sampling 5 We want p(C|+s) –Do prior sampling, but ignore (reject) samples which don’t have S=+s –It is also consistent for conditional probabilities (i.e., correct in the limit) Problem –If p(+s) is too small then many samples are wasted +c, -s, +r, +w +c, +s, +r, +w -c, +s, +r, -w +c, -s, +r, +w -c, -s, -r, +w

7
Likelihood Weighting 6 Step 1: sampling unvalued variables z (given evidences e) Step 2: fix the evidences Step 3: the generated samples have weight Likelihood weighting is consistent z: C, R e: S, W

8
Particle filtering Dynamic Bayesian networks Viterbi algorithm 7 Today

9
Particle Filtering 8 Sometimes |X| is too big to use exact inference –|X| may be too big to even store B(X) –E.g. X is continuous –|X| 2 may be too big to do updates 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

10
Representation: Particles 9 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 with value x –Many x will have p(x)=0! –More particles, more accuracy For now, all particles have a weight of 1 Particles: (3,3) (2,3) (3,3) (3,2) (3,3) (3,2) (2,1) (3,3) (2,1)

11
Particle Filtering: Elapse Time 10 Each particle is moved by sampling its next position from the transition model x’= sample(p(X’|x)) –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 we have enough samples, close to the exact values before and after (consistent)

12
Particle Filtering: Observe 11 Slightly trickier: –Don’t do rejection sampling (why not?) –Likelihood weighting –Note that, as before, the probabilities don’t sum to one, since most have been downweighted in fact they sum to an approximation of p(e)

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

14
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 ) sum up to 1 13 Forward algorithm vs. particle filtering Forward algorithm Particle filtering Elapse of time x--->x’ Observe w(x’)=p(e t |x) Resample resample N particles

15
Robot Localization 14 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

16
Dynamic Bayes Nets (DBNs) 15 We want to track multiple variables over time, using multiple sources of evidence Idea: repeat a fixed Bayes net structure at each time Variables from time t can condition on those from t-1 DBNs with evidence at leaves are HMMs

17
Exact Inference in DBNs 16 Variable elimination applies to dynamic Bayes nets Procedure: “unroll” the network for T time steps, then eliminate variables until p(X t |e 1:t ) is computed Online belief updates: eliminate all variables from the previous time step; store factors for current time only

18
DBN Particle Filters 17 A particle is a complete sample for a time step Initialize: generate prior samples for the t=1 Bayes net –Example particle: G 1 a =(3,3) G 1 b =(5,3) Elapse time: sample a successor for each particle –Example successor: G 2 a =(2,3) G 2 b =(6,3) Observe: weight each entire sample by the likelihood of the evidence conditioned on the sample –Likelihood: p(E 1 a |G 1 a )*p(E 1 b |G 1 b ) Resample: select prior samples (tuples of values) in proportion to their likelihood

19
SLAM 18 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

20
HMMs: MLE Queries 19 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:

21
State Path 20 Graph of states and transitions over time 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 X 1 X 2 … X N

22
Viterbi Algorithm 21

23
Example 22 XEp +r+u0.9 +r-u0.1 -r+u0.2 -r-u0.8

Similar presentations

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google