today cs 188 artificial intelligence
play

Today CS 188: Artificial Intelligence HMMs, Particle Filters, and - PowerPoint PPT Presentation

Today CS 188: Artificial Intelligence HMMs, Particle Filters, and Applications HMMs Particle filters Demos! Mostlikelyexplanation queries Applications: Robot localization / mapping Speech recognition (later)


  1. Today CS 188: Artificial Intelligence HMMs, Particle Filters, and Applications � HMMs � Particle filters � Demos! � Most‐likely‐explanation queries � Applications: � Robot localization / mapping � Speech recognition (later) Instructors: Dan Klein and Pieter Abbeel University of California, Berkeley [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.] [Demo: Ghostbusters Markov Model (L15D1)] Recap: Reasoning Over Time Inference: Base Cases � Markov models 0.3 X 1 0.7 X 1 X 2 X 3 X 4 rain sun X 1 X 2 0.7 E 1 0.3 � Hidden Markov models X E P X 1 X 2 X 3 X 4 X 5 rain umbrella 0.9 rain no umbrella 0.1 sun umbrella 0.2 E 1 E 2 E 3 E 4 E 5 sun no umbrella 0.8

  2. Inference: Base Cases Passage of Time � Assume we have current belief P(X | evidence to date) X 1 X 2 X 1 X 2 � Then, after one time step passes: � Or compactly: � 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 Example: Passage of Time Inference: Base Cases � As time passes, uncertainty “ accumulates ” (Transition model: ghosts usually go clockwise) X 1 E 1 T = 1 T = 2 T = 5

  3. Observation Example: Observation � Assume we have current belief P(X | previous evidence): X 1 � As we get observations, beliefs get reweighted, uncertainty “ decreases ” � Then, after evidence comes in: E 1 Before observation After observation � Basic idea: beliefs “reweighted” � Or, compactly: by likelihood of evidence � Unlike passage of time, we have to renormalize Filtering Particle Filtering Elapse time: compute P( X t | e 1:t‐1 ) Observe: compute P( X t | e 1:t ) Belief: <P(rain), P(sun)> <0.5, 0.5> Prior on X 1 X 1 X 2 <0.82, 0.18> Observe E 1 E 2 <0.63, 0.37> Elapse time <0.88, 0.12> Observe [Demo: Ghostbusters Exact Filtering (L15D2)]

  4. Particle Filtering Representation: Particles � Filtering: approximate solution 0.0 0.1 0.0 � Our representation of P(X) is now a list of N particles (samples) � Sometimes |X| is too big to use exact inference � Generally, N << |X| � |X| may be too big to even store B(X) 0.0 0.0 0.2 � Storing map from X to counts would defeat the point � E.g. X is continuous 0.0 0.2 0.5 � Solution: approximate inference � P(x) approximated by number of particles with value x � Track samples of X, not all values � So, many x may have P(x) = 0! � Samples are called particles Particles: � Time per step is linear in the number of samples � More particles, more accuracy (3,3) (2,3) � But: number needed may be large (3,3) � In memory: list of particles, not states (3,2) � For now, all particles have a weight of 1 (3,3) (3,2) � This is how robot localization works in practice (1,2) (3,3) (3,3) � Particle is just new name for sample (2,3) Particle Filtering: Elapse Time Particle Filtering: Observe � Each particle is moved by sampling its next Particles: � Slightly trickier: (3,2) Particles: (2,3) position from the transition model (3,3) (3,2) (2,3) � Don’t sample observation, fix it (3,1) (3,3) (3,3) (3,2) � Similar to likelihood weighting, downweight (3,2) (3,3) (1,3) (3,2) samples based on the evidence (2,3) (1,2) (3,2) (3,3) � This is like prior sampling – samples’ frequencies (2,2) (3,3) reflect the transition probabilities (2,3) � Here, most samples move clockwise, but some move in another direction or stay in place Particles: Particles: (3,2) (3,2) w=.9 (2,3) (2,3) w=.2 (3,2) (3,2) w=.9 � This captures the passage of time (3,1) � As before, the probabilities don’t sum to one, (3,1) w=.4 (3,3) (3,3) w=.4 since all have been downweighted (in fact they (3,2) � If enough samples, close to exact values before and (3,2) w=.9 (1,3) now sum to (N times) an approximation of P(e)) (1,3) w=.1 after (consistent) (2,3) (2,3) w=.2 (3,2) (3,2) w=.9 (2,2) (2,2) w=.4

  5. Particle Filtering: Resample Recap: Particle Filtering � Particles: track samples of states rather than an explicit distribution � Rather than tracking weighted samples, we Particles: (3,2) w=.9 resample Elapse Weight Resample (2,3) w=.2 (3,2) w=.9 (3,1) w=.4 (3,3) w=.4 � N times, we choose from our weighted sample (3,2) w=.9 (1,3) w=.1 distribution (i.e. draw with replacement) (2,3) w=.2 (3,2) w=.9 (2,2) w=.4 � This is equivalent to renormalizing the distribution Particles: Particles: Particles: (New) Particles: (3,3) (3,2) (3,2) w=.9 (3,2) (New) Particles: (2,3) (2,3) (2,3) w=.2 (2,2) (3,2) (3,3) (3,2) (3,2) w=.9 (3,2) (2,2) � Now the update is complete for this time step, (3,2) (3,1) (3,1) w=.4 (2,3) (3,2) (3,3) (3,3) (3,3) w=.4 (3,3) (2,3) continue with the next one (3,2) (3,2) (3,2) w=.9 (3,2) (3,3) (1,2) (1,3) (1,3) w=.1 (1,3) (3,2) (3,3) (2,3) (2,3) w=.2 (2,3) (1,3) (3,3) (3,2) (3,2) w=.9 (3,2) (2,3) (2,3) (2,2) (2,2) w=.4 (3,2) (3,2) (3,2) [Demos: ghostbusters particle filtering (L15D3,4,5)] Robot Localization Particle Filter Localization (Sonar) � 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 [Video: global‐sonar‐uw‐annotated.avi]

  6. Particle Filter Localization (Laser) 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 [Video: global‐floor.gif] [Demo: PARTICLES‐SLAM‐mapping1‐new.avi] Particle Filter SLAM – Video 1 Particle Filter SLAM – Video 2 [Demo: PARTICLES‐SLAM‐mapping1‐new.avi] [Demo: PARTICLES‐SLAM‐fastslam.avi]

  7. Dynamic Bayes Nets Dynamic Bayes Nets (DBNs) � 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 t =1 t =2 t =3 G 1 a G 2 a G 3 a G 1 b G 2 b G 3 b E 1 a E 1 b E 2 a E 2 b E 3 a E 3 b � Dynamic Bayes nets are a generalization of HMMs [Demo: pacman sonar ghost DBN model (L15D6)] Pacman – Sonar (P4) Exact Inference in DBNs � 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 t =1 t =2 t =3 a a a G 1 G 2 G 3 G 1 b G 2 b G 3 G 3 b b E 1 a E 1 b E 2 a E 2 b E 3 a E 3 b � Online belief updates: Eliminate all variables from the previous time step; store factors for current time only [Demo: Pacman – Sonar – No Beliefs(L14D1)]

  8. DBN Particle Filters Most Likely Explanation � 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 HMMs: MLE Queries State Trellis � State trellis: graph of states and transitions over time � HMMs defined by X 1 X 2 X 3 X 4 X 5 sun sun sun sun � States X � Observations E rain rain rain rain � Initial distribution: E 1 E 2 E 3 E 4 E 5 � Transitions: � Emissions: � Each arc represents some transition � Each arc has weight � New query: most likely explanation: � Each path is a sequence of states � The product of weights on a path is that sequence’s probability along with the evidence � New method: the Viterbi algorithm � Forward algorithm computes sums of paths, Viterbi computes best paths

  9. Forward / Viterbi Algorithms sun sun sun sun rain rain rain rain Forward Algorithm (Sum) Viterbi Algorithm (Max)

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend