CSE 473: Ar+ficial Intelligence. Probability Recap. Markov Models - II. Condi+onal probability. Product rule. Chain rule.

Similar documents
CSE 473: Ar+ficial Intelligence. Example. Par+cle Filters for HMMs. An HMM is defined by: Ini+al distribu+on: Transi+ons: Emissions:

CSE 473: Ar+ficial Intelligence

CS 5522: Artificial Intelligence II

CS 5522: Artificial Intelligence II

CS 188: Artificial Intelligence

CS 188: Artificial Intelligence Spring Announcements

Markov Models. CS 188: Artificial Intelligence Fall Example. Mini-Forward Algorithm. Stationary Distributions.

CS 343: Artificial Intelligence

CSE 473: Artificial Intelligence

CSEP 573: Artificial Intelligence

Hidden Markov Models. Hal Daumé III. Computer Science University of Maryland CS 421: Introduction to Artificial Intelligence 19 Apr 2012

Announcements. CS 188: Artificial Intelligence Fall VPI Example. VPI Properties. Reasoning over Time. Markov Models. Lecture 19: HMMs 11/4/2008

CS 5522: Artificial Intelligence II

CS 343: Artificial Intelligence

CS 5522: Artificial Intelligence II

Announcements. CS 188: Artificial Intelligence Fall Markov Models. Example: Markov Chain. Mini-Forward Algorithm. Example

CS 188: Artificial Intelligence Spring 2009

Markov Chains and Hidden Markov Models

CS 343: Artificial Intelligence

CSE 473: Artificial Intelligence Spring 2014

CSE 473: Ar+ficial Intelligence. Hidden Markov Models. Bayes Nets. Two random variable at each +me step Hidden state, X i Observa+on, E i

Hidden Markov Models. Vibhav Gogate The University of Texas at Dallas

CSCI 360 Introduc/on to Ar/ficial Intelligence Week 2: Problem Solving and Op/miza/on. Professor Wei-Min Shen Week 8.1 and 8.2

Approximate Inference

Probability, Markov models and HMMs. Vibhav Gogate The University of Texas at Dallas

Markov Models and Hidden Markov Models

CSE 473: Artificial Intelligence

CSE 473: Artificial Intelligence Probability Review à Markov Models. Outline

Outline. CSE 573: Artificial Intelligence Autumn Agent. Partial Observability. Markov Decision Process (MDP) 10/31/2012

CS 188: Artificial Intelligence Fall Recap: Inference Example

CS 188: Artificial Intelligence

CS188 Outline. We re done with Part I: Search and Planning! Part II: Probabilistic Reasoning. Part III: Machine Learning

Mini-project 2 (really) due today! Turn in a printout of your work at the end of the class

CS 5522: Artificial Intelligence II

CS188 Outline. CS 188: Artificial Intelligence. Today. Inference in Ghostbusters. Probability. We re done with Part I: Search and Planning!

Our Status in CSE 5522

Bayes Nets: Sampling

Hidden Markov Models. AIMA Chapter 15, Sections 1 5. AIMA Chapter 15, Sections 1 5 1

Our Status. We re done with Part I Search and Planning!

CS 188: Artificial Intelligence. Our Status in CS188

CS 343: Artificial Intelligence

Reinforcement Learning Wrap-up

CS 188: Artificial Intelligence Fall 2011

CS 343: Artificial Intelligence

Sta$s$cal sequence recogni$on

CS 188: Artificial Intelligence Spring Announcements

Hidden Markov models 1

Introduc)on to Ar)ficial Intelligence

Par$cle Filters Part I: Theory. Peter Jan van Leeuwen Data- Assimila$on Research Centre DARC University of Reading

Particle Filters. Pieter Abbeel UC Berkeley EECS. Many slides adapted from Thrun, Burgard and Fox, Probabilistic Robotics

Markov localization uses an explicit, discrete representation for the probability of all position in the state space.

CS 188: Artificial Intelligence Fall 2011

Artificial Intelligence Bayes Nets: Independence

CS 343: Artificial Intelligence

Machine Learning & Data Mining CS/CNS/EE 155. Lecture 8: Hidden Markov Models

Approximate Q-Learning. Dan Weld / University of Washington

Introduction to Artificial Intelligence (AI)

CS 188: Artificial Intelligence. Bayes Nets

CS 188: Artificial Intelligence Spring Announcements

Probabilistic Models. Models describe how (a portion of) the world works

Bayes Nets: Independence

CSCI 360 Introduc/on to Ar/ficial Intelligence Week 2: Problem Solving and Op/miza/on

Announcements. CS 188: Artificial Intelligence Fall Causality? Example: Traffic. Topology Limits Distributions. Example: Reverse Traffic

CS 7180: Behavioral Modeling and Decision- making in AI

Machine Learning & Data Mining CS/CNS/EE 155. Lecture 11: Hidden Markov Models

Bayesian networks Lecture 18. David Sontag New York University

Human-Oriented Robotics. Temporal Reasoning. Kai Arras Social Robotics Lab, University of Freiburg

CS 188: Artificial Intelligence Fall 2009

PROBABILISTIC REASONING OVER TIME

Graphical Models. Lecture 1: Mo4va4on and Founda4ons. Andrew McCallum

Bayesian Networks BY: MOHAMAD ALSABBAGH

Bayes Net Representation. CS 188: Artificial Intelligence. Approximate Inference: Sampling. Variable Elimination. Sampling.

Hidden Markov Models (recap BNs)

CS532, Winter 2010 Hidden Markov Models

CS325 Artificial Intelligence Ch. 15,20 Hidden Markov Models and Particle Filtering

Product rule. Chain rule

CS 188: Artificial Intelligence Fall Announcements

Bayesian Networks. Vibhav Gogate The University of Texas at Dallas

CS 5522: Artificial Intelligence II

Introduction to Mobile Robotics Probabilistic Robotics

Forward algorithm vs. particle filtering

CSE 473: Artificial Intelligence Autumn 2011

CS 343: Artificial Intelligence

CS 188: Artificial Intelligence Fall 2009

Bayes Nets III: Inference

Reasoning Under Uncertainty Over Time. CS 486/686: Introduction to Artificial Intelligence

Bayesian Networks. Vibhav Gogate The University of Texas at Dallas

Introduction to Particle Filters for Data Assimilation

Final Exam December 12, 2017

CS 5522: Artificial Intelligence II

Why do we care? Measurements. Handling uncertainty over time: predicting, estimating, recognizing, learning. Dealing with time

Announcements. Inference. Mid-term. Inference by Enumeration. Reminder: Alarm Network. Introduction to Artificial Intelligence. V22.

CS 188: Artificial Intelligence Spring Announcements

Announcements. Recap: Filtering. Recap: Reasoning Over Time. Example: State Representations for Robot Localization. Particle Filtering

Introduction to Artificial Intelligence (AI)

Computer Vision Group Prof. Daniel Cremers. 14. Sampling Methods

Extensions of Bayesian Networks. Outline. Bayesian Network. Reasoning under Uncertainty. Features of Bayesian Networks.

The Particle Filter. PD Dr. Rudolph Triebel Computer Vision Group. Machine Learning for Computer Vision

Temporal probability models. Chapter 15

Reasoning Under Uncertainty: Bayesian networks intro

Transcription:

CSE 473: Ar+ficial Intelligence Markov Models - II Daniel S. Weld - - - University of Washington [Most slides were created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley. All CS188 materials are available at hmp://ai.berkeley.edu.] Condi+onal probability Product rule Chain rule Probability Recap Bayes rule X, Y independent if and only if: X and Y are condi+onally independent given Z: if and only if: 1

Reasoning over Time or Space OYen, we want to reason about a sequence of observa+ons Speech recogni+on Robot localiza+on User amen+on Medical monitoring Need to introduce +me (or space) into our models Markov Models Recap Explicit assump+on for all t : X t? X 1,...,X t 2 X t 1 Consequence, joint distribu+on can be wrimen as: P (X 1,X 2,...,X T )=P(X 1 )P (X 2 X 1 )P (X 3 X 2 )...P(X T X T 1 ) TY = P (X 1 ) P (X t X t 1 ) t=2 Addi+onal explicit assump+on: is the same for all t P (X t X t 1 ) is the same for all t T-1 T 2

Example Markov Chain: Weather States: X = {rain, sun} Ini+al distribu+on: 1.0 sun CPT P(X t X t- 1 ): Two new ways of represen+ng the same CPT X t- 1 X t P(X t X t- 1 ) sun sun 0.9 sun rain 0.1 rain sun 0.3 rain rain 0.7 0.7 rain 0.3 0.1 sun 0.9 sun rain 0.9 0.1 0.3 0.7 sun rain Mini- Forward Algorithm Ques+on: What s P(X) on some day t? X 1 X 2 X 3 X 4 P (x t )= X x t 1 P (x t 1,x t ) = X x t 1 P (x t x t 1 )P (x t 1 ) Forward simulation 3

Example Run of Mini- Forward Algorithm From ini+al observa+on of sun P(X 1 ) P(X 2 ) P(X 3 ) P(X 4 ) P(X ) From ini+al observa+on of rain P(X 1 ) P(X 2 ) P(X 3 ) P(X 4 ) P(X ) From yet another ini+al distribu+on P(X 1 ):? P(X 1 ) P(X ) [Demo: L13D1,2,3] Hidden Markov Models 8 4

Hidden Markov Models Markov chains not so useful for most agents Eventually you don t know anything anymore Need observa+ons to update your beliefs Hidden Markov models (HMMs) Underlying Markov chain over states S You observe outputs (effects) at each +me step As a Bayes net: X 1 X 2 X 3 X 4 X N 5 E 1 E 2 E 3 E 4 E N 5 Example An HMM is defined by: Ini+al distribu+on: Transi+ons: Emissions: 5

Hidden Markov Models X 1 X 2 X 3 X 4 X N 5 E 1 E 2 E 3 E 4 E N 5 Defines a joint probability distribu+on: Condi+onal Independence HMMs have two important independence proper+es: Markov hidden process, future depends on past via the present?? X 1 X 2 X 3 X 4 E 1 E 1 E 3 E 4 6

Condi+onal Independence HMMs have two important independence proper+es: Markov hidden process, future depends on past via the present Current observa+on independent of all else given current state? X 1 X 2 X 3 X 4 E 1 E 1 E 3 E 4? Condi+onal Independence HMMs have two important independence proper+es: Markov hidden process, future depends on past via the present Current observa+on independent of all else given current state X 1 X 2 X 3 X 4 E 1 E 1 E 3 E 4?? Quiz: does this mean that observa+ons are independent given no evidence? [No, correlated by the hidden state] 7

HMM Computa+ons Given parameters evidence E 1:n =e 1:n Inference problems include: Filtering, find P(X t e 1:t ) for all t Smoothing, find P(X t e 1:n ) for all t Most probable explanation, find x* 1:n = argmaxx 1:n P(x 1:n e 1:n ) Filtering (aka Monitoring) The task of tracking the agent s belief state, B(x), over >me B(x) is a distribu+on over world states repr agent knowledge We start with B(X) in an ini+al seqng, usually uniform As +me passes, or we get observa+ons, we update B(X) Many algorithms for this: Exact probabilis+c inference Par+cle filter approxima+on Kalman filter (one method Real valued values) invented in the 60 for Apollo Program real- valued state, Gaussian noise 8

HMM Examples Robot tracking: Observa+ons are range readings (con+nuous) States are posi+ons on a map (con+nuous) X 1 X 2 X 3 X 4 E 1 E 1 E 3 E 4 Example: Robot Localiza+on Example from Michael Pfeiffer Prob 0 t=0 Sensor model: never more than 1 mistake Mo+on model: may not execute ac+on with small prob. 1 9

Example: Robot Localiza+on Prob 0 1 t=1 Example: Robot Localiza+on Prob 0 1 t=2 10

Example: Robot Localiza+on Prob 0 1 t=3 Example: Robot Localiza+on Prob 0 1 t=4 11

Example: Robot Localiza+on Prob 0 1 t=5 Other Real HMM Examples Speech recogni+on HMMs: Observa+ons are acous+c signals (con+nuous valued) States are specific posi+ons in specific words (so, tens of thousands) X 1 X 2 X 3 X 4 E 1 E 1 E 3 E 4 12

Other Real HMM Examples Machine transla+on HMMs: Observa+ons are words (tens of thousands) States are transla+on op+ons X 1 X 2 X 3 X 4 E 1 E 1 E 3 E 4 Inference: Base Cases Observation Passage of Time X 1 X 1 X2 E 1 13

Passage of Time Assume we have current belief P(X evidence to date) X 1 X 2 Then, ayer one +me step passes: P (X t+1 e 1:t ) = X x t P (X t+1,x t e 1:t ) = X x t P (X t+1 x t,e 1:t )P (x t e 1:t ) = X x t P (X t+1 x t )P (x t e 1:t ) Or compactly: B 0 (X t+1 ) = X x t P (X 0 x t )B(x t ) Basic idea: beliefs get pushed through the transi+ons With the B nota+on, we have to be careful about what +me step t the belief is about, and what evidence it includes Example: Passage of Time As +me passes, uncertainty accumulates (Transi+on model: ghosts usually go clockwise) T = 1 T = 2 T = 5 14

Observa+on Assume we have current belief P(X previous evidence): B 0 (X t+1 )=P(X t+1 e 1:t ) Then, ayer evidence comes in: P (X t+1 e 1:t+1 ) = P (X t+1,e t+1 e 1:t )/P (e t+1 e 1:t ) / Xt+1 P (X t+1,e t+1 e 1:t ) X 1 E 1 = P (e t+1 e 1:t,X t+1 )P (X t+1 e 1:t ) Or, compactly: = P (e t+1 X t+1 )P (X t+1 e 1:t ) B(X t+1 ) / Xt+1 P (e t+1 X t+1 )B 0 (X t+1 ) Basic idea: beliefs reweighted by likelihood of evidence Unlike passage of +me, we have to renormalize Example: Observa+on As we get observa+ons, beliefs get reweighted, uncertainty decreases Before observa+on AYer observa+on 15

Example: Weather HMM B (+r) = 0.5 B (- r) = 0.5 B (+r) = 0.627 B (- r) = 0.373 B(+r) = 0.5 B(- r) = 0.5 B(+r) = 0.818 B(- r) = 0.182 B(+r) = 0.883 B(- r) = 0.117 Rain 0 Rain 1 Rain 2 Umbrella 1 Umbrella 2 R t R t+1 P(R t+1 R t ) +r +r 0.7 +r - r 0.3 - r +r 0.3 - r - r 0.7 R t U t P(U t R t ) +r +u 0.9 +r - u 0.1 - r +u 0.2 - r - u 0.8 Pacman Sonar (P4) [Demo: Pacman Sonar No Beliefs(L14D1)] 16

Video of Demo Pacman Sonar (with beliefs) Summary: Online Belief Updates Every +me step, we start with current P(X evidence) We update for +me: X 1 X 2 We update for evidence: X 2 The forward algorithm does both at once (and doesn t normalize) E 2 17

The Forward Algorithm We are given evidence at each +me and want to know We use the single (+me- passage+observa+on) updates: We can normalize as we go if we want to have P(x e) at each +me step, or just once at the end Complexity? O( X 2 ) +me & O(X) space Par+cle Filtering 18

Par+cle Filtering Filtering: approximate solu+on Some+mes X is too big to use exact inference X may be too big to even store B(X) E.g. X is con+nuous Solu+on: approximate inference Track samples of X, not all values Samples are called par+cles Time per step is linear in the number of samples But: number needed may be large In memory: list of par+cles, not states 0.0 0.1 0.0 0.0 0.0 0.2 0.0 0.2 0.5 This is how robot localiza+on works in prac+ce Par+cle is just new name for sample Representa+on: Par+cles Our representa+on of P(X) is now a list of N par+cles (samples) Generally, N << X Storing map from X to counts would defeat the point P(x) approximated by number of par+cles with value x So, many x may have P(x) = 0! More par+cles, more accuracy For now, all par+cles have a weight of 1 Par+cles: (1,2) 19

Par+cle Filtering: Elapse Time Each par+cle is moved by sampling its next posi+on from the transi+on model This is like prior sampling samples frequencies reflect the transi+on probabili+es Here, most samples move clockwise, but some move in another direc+on or stay in place This captures the passage of +me If enough samples, close to exact values before and ayer (consistent) Par+cles: (1,2) Par+cles: (3,1) (1,3) (2,2) Par+cle Filtering: Observe Slightly trickier: Don t sample observa+on, fix it Similar to likelihood weigh+ng, downweight samples based on the evidence Par+cles: (3,1) (1,3) (2,2) As before, the probabili+es don t sum to one, since all have been downweighted (in fact they now sum to (N +mes) an approxima+on of P(e)) Par+cles: w=.9 w=.2 w=.9 (3,1) w=.4 w=.4 w=.9 (1,3) w=.1 w=.2 w=.9 (2,2) w=.4 20

Par+cle Filtering: Resample Rather than tracking weighted samples, we resample N +mes, we choose from our weighted sample distribu+on (i.e. draw with replacement) This is equivalent to renormalizing the distribu+on Now the update is complete for this +me step, con+nue with the next one Par+cles: w=.9 w=.2 w=.9 (3,1) w=.4 w=.4 w=.9 (1,3) w=.1 w=.2 w=.9 (2,2) w=.4 (New) Par+cles: (2,2) (1,3) Recap: Par+cle Filtering Par+cles: track samples of states rather than an explicit distribu+on Elapse Weight Resample Par+cles: (1,2) Par+cles: (3,1) (1,3) (2,2) Par+cles: w=.9 w=.2 w=.9 (3,1) w=.4 w=.4 w=.9 (1,3) w=.1 w=.2 w=.9 (2,2) w=.4 (New) Par+cles: (2,2) (1,3) [Demos: ghostbusters par+cle filtering (L15D3,4,5)] 21

Video of Demo Moderate Number of Par+cles Video of Demo One Par+cle 22

Video of Demo Huge Number of Par+cles Robot Localiza+on In robot localiza+on: We know the map, but not the robot s posi+on Observa+ons may be vectors of range finder readings State space and readings are typically con+nuous (works basically like a very fine grid) and so we cannot store B(X) Par+cle filtering is a main technique 23

Par+cle Filter Localiza+on (Sonar) [Video: global- sonar- uw- annotated.avi] Par+cle Filter Localiza+on (Laser) [Video: global- floor.gif] 24

Robot Mapping SLAM: Simultaneous Localiza+on And Mapping We do not know the map or our loca+on State consists of posi+on AND map! Main techniques: Kalman filtering (Gaussian HMMs) and par+cle methods DP- SLAM, Ron Parr [Demo: PARTICLES- SLAM- mapping1- new.avi] Par+cle Filter SLAM Video 1 [Demo: PARTICLES- SLAM- mapping1- new.avi] 25

Par+cle Filter SLAM Video 2 [Demo: PARTICLES- SLAM- fastslam.avi] 26