CS 188: Artificial Intelligence Spring 2009

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

CS 188: Artificial Intelligence Spring Announcements

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

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

Markov Chains and Hidden Markov Models

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

CS 343: Artificial Intelligence

Approximate Inference

CSEP 573: Artificial Intelligence

CS 5522: Artificial Intelligence II

CS 5522: Artificial Intelligence II

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

CS 188: Artificial Intelligence Fall Recap: Inference Example

CSE 473: Artificial Intelligence

CSE 473: Ar+ficial Intelligence

CS 188: Artificial Intelligence

CSE 473: Artificial Intelligence Spring 2014

CS 188: Artificial Intelligence

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

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

CS 5522: Artificial Intelligence II

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

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

CS 343: Artificial Intelligence

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

CS 343: Artificial Intelligence

CS 5522: Artificial Intelligence II

CS 5522: Artificial Intelligence II

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

Markov Models and Hidden Markov Models

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

CSE 473: Artificial Intelligence

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

Introduction to Artificial Intelligence (AI)

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

CS 188: Artificial Intelligence Fall 2011

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

Bayes Nets III: Inference

CS 188: Artificial Intelligence. Our Status in CS188

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

CS 188: Artificial Intelligence Fall 2009

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

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence Fall 2009

Introduction to Artificial Intelligence (AI)

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence Fall 2011

CS 343: Artificial Intelligence

CS 343: Artificial Intelligence

Hidden Markov models 1

Probability and Time: Hidden Markov Models (HMMs)

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. AIMA Chapter 15, Sections 1 5. AIMA Chapter 15, Sections 1 5 1

CS 188: Artificial Intelligence Fall 2008

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

CS 188: Artificial Intelligence Spring Announcements

Bayesian Networks BY: MOHAMAD ALSABBAGH

Bayes Nets: Sampling

CS 188: Artificial Intelligence. Bayes Nets

Announcements. CS 188: Artificial Intelligence Spring Probability recap. Outline. Bayes Nets: Big Picture. Graphical Model Notation

CS 188: Artificial Intelligence Spring Announcements

Reasoning Under Uncertainty: Bayesian networks intro

Hidden Markov Models (recap BNs)

Announcements. CS 188: Artificial Intelligence Spring Classification. Today. Classification overview. Case-Based Reasoning

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

Reinforcement Learning Wrap-up

CS 188: Artificial Intelligence Spring Announcements

CS532, Winter 2010 Hidden Markov Models

CS 343: Artificial Intelligence

Machine Learning for Data Science (CS4786) Lecture 19

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

Artificial Intelligence Bayes Nets: Independence

Probability Hal Daumé III. Computer Science University of Maryland CS 421: Introduction to Artificial Intelligence 27 Mar 2012

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

CS 5522: Artificial Intelligence II

Hidden Markov Models. Aarti Singh Slides courtesy: Eric Xing. Machine Learning / Nov 8, 2010

Statistical Problem. . We may have an underlying evolving system. (new state) = f(old state, noise) Input data: series of observations X 1, X 2 X t

Introduction to Machine Learning CMU-10701

Hidden Markov Models. By Parisa Abedi. Slides courtesy: Eric Xing

Forward algorithm vs. particle filtering

Intelligent Systems (AI-2)

PROBABILISTIC REASONING OVER TIME

Intelligent Systems (AI-2)

CS 5522: Artificial Intelligence II

Why do we care? Examples. Bayes Rule. What room am I in? Handling uncertainty over time: predicting, estimating, recognizing, learning

Intelligent Systems (AI-2)

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

CSE 473: Artificial Intelligence Autumn 2011

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

Approximate Q-Learning. Dan Weld / University of Washington

Probabilistic Models

Hidden Markov Models,99,100! Markov, here I come!

CS 4100 // artificial intelligence. Recap/midterm review!

CS 188: Artificial Intelligence. Machine Learning

Intelligent Systems (AI-2)

CS491/691: Introduction to Aerial Robotics

CSEP 573: Artificial Intelligence

HMM part 1. Dr Philip Jackson

Bayes Nets: Independence

Transcription:

CS 188: Artificial Intelligence Spring 2009 Lecture 21: Hidden Markov Models 4/7/2009 John DeNero UC Berkeley Slides adapted from Dan Klein Announcements Written 3 deadline extended! Posted last Friday Was due one week from today Now due one week from Thursday Still start it early! Project 4 posted tomorrow, due Wed 4/22 Midterm review in office hours Today: 1-2 (q1,q3) and 3-4 (q2, q5) Tomorrow 11-12 (q4, q6) 2 1

Reasoning over Time Often, we want to reason about a sequence of observations Speech recognition Robot localization User attention Medical monitoring Need to introduce time into our models Basic approach: hidden Markov models (HMMs) More general: dynamic Bayes nets 3 Markov Models A Markov model is a chain-structured BN Each node is identically distributed (stationarity) Value of X at a given time is called the state As a BN: X 1 X 2 X 3 X 4 Parameters: called transition probabilities or dynamics, specify how the state evolves over time (also, initial probs) 4 [DEMO: Battleship] 2

Conditional Independence X 1 X 2 X 3 X 4 Basic conditional independence: Past and future independent of the present Each time step only depends on the previous This is called the (first order) Markov property Note that the chain is just a (growing) BN We can always use generic BN reasoning on it if we truncate the chain at a fixed length 5 Example: Markov Chain Weather: States: X = {rain, sun} Transitions: rain 0.1 sun 0.9 0.9 Initial distribution: 1.0 sun What s the probability distribution after one step? 0.1 This is a CPT, not a BN! 6 3

Mini-Forward Algorithm Question: probability of being in state x at time t? Slow answer: Enumerate all sequences of length t which end in s Add up their probabilities 7 Mini-Forward Algorithm Better way: cached incremental belief updates An instance of variable elimination! sun sun sun sun rain rain rain rain Forward simulation 8 4

Example From initial observation of sun P(X 1 ) P(X 2 ) P(X 3 ) P(X ) From initial observation of rain P(X 1 ) P(X 2 ) P(X 3 ) P(X ) 9 Stationary Distributions If we simulate the chain long enough: What happens? Uncertainty accumulates Eventually, we have no idea what the state is! Stationary distributions: For most chains, the distribution we end up in is independent of the initial distribution Called the stationary distribution of the chain Usually, can only predict a short time out [DEMO: Ghostbusters] 5

Web Link Analysis PageRank over a web graph Each web page is a state Initial distribution: uniform over pages Transitions: With prob. c, uniform jump to a random page (dotted lines) With prob. 1-c, follow a random outlink (solid lines) Stationary distribution Will spend more time on highly reachable pages E.g. many ways to get to the Acrobat Reader download page! Somewhat robust to link spam Google 1.0 returned the set of pages containing all your keywords in decreasing rank, now all search engines use link analysis along with many other factors 11 Hidden Markov Models Markov chains not so useful for most agents Eventually you don t know anything anymore Need observations to update your beliefs Hidden Markov models (HMMs) Underlying Markov chain over states S You observe outputs (effects) at each time step As a Bayes net: X 1 X 2 X 3 X 4 X 5 E 1 E 2 E 3 E 4 E 5 6

Example An HMM is defined by: Initial distribution: Transitions: Emissions: Conditional Independence HMMs have two important independence properties: Markov hidden process, future depends on past via the present Current observation independent of all else given current state X 1 X 2 X 3 X 4 X 5 E 1 E 2 E 3 E 4 E 5 Quiz: does this mean that observations are independent given no evidence? [No, correlated by the hidden state] 7

Ghostbusters HMM P(X 1 ) = uniform P(X X ) = usually move clockwise, but sometimes move in a random direction or stay in place P(R ij X) = same sensor model as before: red means close, green means far away. 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 P(X 1 ) 1/6 1/6 1/2 X 1 X 2 X 3 X 4 X 5 R i,j R i,j R i,j R i,j E5 0 1/6 0 0 0 0 P(X X =<1,2>) [Demo] 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) 8

Filtering / Monitoring Filtering, or monitoring, is the task of tracking the distribution B(X) (the belief state) We start with B(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 [Demo] Example: Robot Localization Example from Michael Pfeiffer Prob 0 t=0 Sensor model: never more than 1 mistake Motion model: may not execute action with small prob. 1 9

Example: Robot Localization Prob 0 1 t=1 Example: Robot Localization Prob 0 1 t=2 10

Example: Robot Localization Prob 0 1 t=3 Example: Robot Localization Prob 0 1 t=4 11

Example: Robot Localization Prob 0 1 t=5 Inference Recap: Simple Cases X 1 X 1 X 2 E 1 12

Passage of Time Assume we have current belief P(X evidence to date) Then, after one time step passes: X 1 X 2 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 As time passes, uncertainty accumulates T = 1 T = 2 T = 5 Transition model: ghosts usually go clockwise 13

Observation Assume we have current belief P(X previous evidence): X 1 Then: E 1 Or: Basic idea: beliefs reweighted by likelihood of evidence Unlike passage of time, we have to renormalize Example: Observation As we get observations, beliefs get reweighted, uncertainty decreases Before observation After observation 14

Example HMM Example HMM S S S E E 15

The Forward Algorithm We are given evidence at each time and want to know We can derive the following updates We can normalize as we go if we want to have P(x e) at each time step, or just once at the end Belief Updates Every time step, we start with current P(X evidence) We update for time: X 1 X 2 We update for evidence: X 2 E 2 The forward algorithm does both at once (and doesn t normalize) Problem: space is X and time is X 2 per time step 16