Written HW 9 Sol. CS 188 Fall Introduction to Artificial Intelligence

Similar documents
Self assessment due: Monday 4/29/2019 at 11:59pm (submit via Gradescope)

Hidden Markov Models

Two Popular Bayesian Estimators: Particle and Kalman Filters. McGill COMP 765 Sept 14 th, 2017

Estimation of Poses with Particle Filters

Notes for Lecture 17-18

Overview. COMP14112: Artificial Intelligence Fundamentals. Lecture 0 Very Brief Overview. Structure of this course

Temporal probability models

Lecture 2-1 Kinematics in One Dimension Displacement, Velocity and Acceleration Everything in the world is moving. Nothing stays still.

Viterbi Algorithm: Background

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

Temporal probability models. Chapter 15, Sections 1 5 1

Ensamble methods: Boosting

State-Space Models. Initialization, Estimation and Smoothing of the Kalman Filter

Sequential Importance Resampling (SIR) Particle Filter

20. Applications of the Genetic-Drift Model

Let us start with a two dimensional case. We consider a vector ( x,

CS 4495 Computer Vision Tracking 1- Kalman,Gaussian

Ensamble methods: Bagging and Boosting

23.2. Representing Periodic Functions by Fourier Series. Introduction. Prerequisites. Learning Outcomes

Macroeconomic Theory Ph.D. Qualifying Examination Fall 2005 ANSWER EACH PART IN A SEPARATE BLUE BOOK. PART ONE: ANSWER IN BOOK 1 WEIGHT 1/3

Online Convex Optimization Example And Follow-The-Leader

Some Basic Information about M-S-D Systems

Problem Set 5. Graduate Macro II, Spring 2017 The University of Notre Dame Professor Sims

Math 10B: Mock Mid II. April 13, 2016

Block Diagram of a DCS in 411

8. Basic RL and RC Circuits

Two Coupled Oscillators / Normal Modes

GMM - Generalized Method of Moments

Final Spring 2007

Spring Ammar Abu-Hudrouss Islamic University Gaza

SOLUTIONS TO ECE 3084

Smoothing. Backward smoother: At any give T, replace the observation yt by a combination of observations at & before T

Graphical Event Models and Causal Event Models. Chris Meek Microsoft Research

Stationary Distribution. Design and Analysis of Algorithms Andrei Bulatov

RL Lecture 7: Eligibility Traces. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 1

UNIVERSITY OF CALIFORNIA College of Engineering Department of Electrical Engineering and Computer Sciences EECS 121 FINAL EXAM

Using the Kalman filter Extended Kalman filter

A Bayesian Approach to Spectral Analysis

Module 2 F c i k c s la l w a s o s f dif di fusi s o i n

Tom Heskes and Onno Zoeter. Presented by Mark Buller

Recent Developments In Evolutionary Data Assimilation And Model Uncertainty Estimation For Hydrologic Forecasting Hamid Moradkhani

Phys1112: DC and RC circuits

A First Course on Kinetics and Reaction Engineering. Class 19 on Unit 18

1 Review of Zero-Sum Games

CHEAPEST PMT ONLINE TEST SERIES AIIMS/NEET TOPPER PREPARE QUESTIONS

dy dx = xey (a) y(0) = 2 (b) y(1) = 2.5 SOLUTION: See next page

Kriging Models Predicting Atrazine Concentrations in Surface Water Draining Agricultural Watersheds

2.7. Some common engineering functions. Introduction. Prerequisites. Learning Outcomes

Bias in Conditional and Unconditional Fixed Effects Logit Estimation: a Correction * Tom Coupé

Augmented Reality II - Kalman Filters - Gudrun Klinker May 25, 2004

Solutions for Assignment 2

Stochastic models and their distributions

ACE 564 Spring Lecture 7. Extensions of The Multiple Regression Model: Dummy Independent Variables. by Professor Scott H.

Physics 235 Chapter 2. Chapter 2 Newtonian Mechanics Single Particle

EE100 Lab 3 Experiment Guide: RC Circuits

Biol. 356 Lab 8. Mortality, Recruitment, and Migration Rates

) were both constant and we brought them from under the integral.

Probabilistic Robotics The Sparse Extended Information Filter

Matlab and Python programming: how to get started

Zürich. ETH Master Course: L Autonomous Mobile Robots Localization II

Math 2142 Exam 1 Review Problems. x 2 + f (0) 3! for the 3rd Taylor polynomial at x = 0. To calculate the various quantities:

Chapter 15: Phenomena. Chapter 15 Chemical Kinetics. Reaction Rates. Reaction Rates R P. Reaction Rates. Rate Laws

Comparing Means: t-tests for One Sample & Two Related Samples

Speaker Adaptation Techniques For Continuous Speech Using Medium and Small Adaptation Data Sets. Constantinos Boulis

Solutions from Chapter 9.1 and 9.2

INTRODUCTION TO MACHINE LEARNING 3RD EDITION

T L. t=1. Proof of Lemma 1. Using the marginal cost accounting in Equation(4) and standard arguments. t )+Π RB. t )+K 1(Q RB

Hamilton- J acobi Equation: Weak S olution We continue the study of the Hamilton-Jacobi equation:

KEY. Math 334 Midterm III Winter 2008 section 002 Instructor: Scott Glasgow

CSE/NB 528 Lecture 14: From Supervised to Reinforcement Learning (Chapter 9) R. Rao, 528: Lecture 14

Hint: There's a table of particular solutions at the end of today's notes.

Anno accademico 2006/2007. Davide Migliore

5.1 - Logarithms and Their Properties

Machine Learning 4771

15. Bicycle Wheel. Graph of height y (cm) above the axle against time t (s) over a 6-second interval. 15 bike wheel

We just finished the Erdős-Stone Theorem, and ex(n, F ) (1 1/(χ(F ) 1)) ( n

3.1.3 INTRODUCTION TO DYNAMIC OPTIMIZATION: DISCRETE TIME PROBLEMS. A. The Hamiltonian and First-Order Conditions in a Finite Time Horizon

6.003 Homework #9 Solutions

m = 41 members n = 27 (nonfounders), f = 14 (founders) 8 markers from chromosome 19

Robot Motion Model EKF based Localization EKF SLAM Graph SLAM

!!"#"$%&#'()!"#&'(*%)+,&',-)./0)1-*23)

Finish reading Chapter 2 of Spivak, rereading earlier sections as necessary. handout and fill in some missing details!

The equation to any straight line can be expressed in the form:

Ground Rules. PC1221 Fundamentals of Physics I. Kinematics. Position. Lectures 3 and 4 Motion in One Dimension. A/Prof Tay Seng Chuan

Math 111 Midterm I, Lecture A, version 1 -- Solutions January 30 th, 2007

Simulation-Solving Dynamic Models ABE 5646 Week 2, Spring 2010

Approximation Algorithms for Unique Games via Orthogonal Separators

Speech and Language Processing

NEWTON S SECOND LAW OF MOTION

23.5. Half-Range Series. Introduction. Prerequisites. Learning Outcomes

Answers to QUIZ

Tracking. Announcements

CSE-473. A Gentle Introduction to Particle Filters

Description of the MS-Regress R package (Rmetrics)

Linear Gaussian State Space Models

KEY. Math 334 Midterm III Fall 2008 sections 001 and 003 Instructor: Scott Glasgow

Lecture 3: Exponential Smoothing

Lecture 2 April 04, 2018

1. Kinematics I: Position and Velocity

L07. KALMAN FILTERING FOR NON-LINEAR SYSTEMS. NA568 Mobile Robotics: Methods & Algorithms

Transcription:

CS 188 Fall 2018 Inroducion o Arificial Inelligence Wrien HW 9 Sol. Self-assessmen due: Tuesday 11/13/2018 a 11:59pm (submi via Gradescope) For he self assessmen, fill in he self assessmen boxes in your original submission (you can download a PDF copy of your submission from Gradescope be sure o delee any exra ile pages ha Gradescope aaches). For each subpar where your original answer was correc, wrie correc. Oherwise, wrie and explain he correc answer. Do no leave any boxes empy. If you did no submi he homework (or skipped some quesions) bu wish o receive credi for he self-assessmen, we ask ha you firs complee he homework wihou looking a he soluions, and hen perform he self assessmen aferwards. 1

Q1. Paricle Filering: Where are he Two Cars? As before, we are rying o esimae he locaion of cars in a ciy, bu now, we model wo cars joinly, i.e. car i for i {1, 2}. The modified HMM model is as follows: X (i) he locaion of car i S (i) he noisy locaion of he car i from he signal srengh a a nearby cell phone ower G (i) he noisy locaion of car i from GPS X (1) 1 X (1) X (1) +1 S (1) S (2) 1 G (1) S (1) S (1) 1 G (1) +1 G (1) +1 1 G (2) S (2) S (2) 1 G (2) +1 G (2) +1 X (2) 1 X (2) X (2) +1 d D(d) E L (d) E N (d) E G (d) -4 0.05 0 0.02 0-3 0.10 0 0.04 0.03-2 0.25 0.05 0.09 0.07-1 0.10 0.10 0.20 0.15 0 0 0.70 0.30 0.50 1 0.10 0.10 0.20 0.15 2 0.25 0.05 0.09 0.07 3 0.10 0 0.04 0.03 4 0.05 0 0.02 0 The signal srengh from one car ges noisier if he oher car is a he same locaion. Thus, he observaion S (i) depends on he curren sae of he oher car X (j), j i. The ransiion is modeled using a drif model D, he GPS observaion G (i) using he error model E G, and he observaion S (i) using one of he error models E L or E N, depending on he car s speed and he relaive locaion of boh cars. These drif and error models are in he able above. The ransiion and observaion models are: P (S (i) X (i) P (X (i) X (i) 1, X(i) P (G (i) 1 ) = D(X(i), X (j) ) = X (i) 1 ) { E N (X (i) S (i) ), if X (i) X (i) 1 2 or X(i) = X (j) E L (X (i) X (i) ) = E G (X (i) G (i) ). S (i) ), oherwise Throughou his problem you may give answers eiher as unevaluaed numeric expressions (e.g. 0.1 0.5) or as numeric values (e.g. 0.05). The quesions are decoupled. (a) Assume ha a = 3, we have he single paricle 3 = 1, X (2). (i) Wha is he probabiliy ha his paricle becomes 4 = 3, X (2) 4 = 3) afer passing i hrough he dynamics model? P 4 = 3, X (2) 4 = 3 X (1) 3 = 1, X (2) = P 4 = 3 X (1) 3 = 1) P (X (2) 4 = 3 X (2) = D( 3 ( 1)) D(3 2) Answer: 0.025 = 0.25 0.10 = 0.025 also 2

(ii) Assume ha here are no sensor readings a = 4. Wha is he join probabiliy ha he original single paricle (from = 3) becomes 4 = 3, X (2) 4 = 3) and hen becomes 5 = 4, X (2) 5 = 4)? P 4 = 3, X (1) 5 = 4, X (2) 4 = 3, X (2) 5 = 4 X (1) 3 = 1, X (2) = P 4 = 3, X (1) 5 = 4 X (1) 3 = 1) P (X (2) 4 = 3, X (2) 5 = 4 X (2) = P 5 = 4 X (1) 4 = 3) P 4 = 3 X (1) 3 = 1) P (X (2) 5 = 4 X (2) 4 = 3) P (X (2) 4 = 3 X (2) = D( 4 ( 3)) D( 3 ( 1)) D(4 3) D(3 2) = 0.10 0.25 0.10 0.10 = 0.00025 Answer: 0.00025 For he remaining of his problem, we will be using 2 paricles a each ime sep. (b) A = 6, we have paricles [ 6 = 3, X (2) 6 = 0), 6 = 3, X (2) 6 = 5)]. Suppose ha afer weighing, resampling, and ransiioning from = 6 o = 7, he paricles become [, ]. (i) A = 7, you ge he observaions S (1) 7 = 2, G (1) 7 = 2, S (2) 7 = 2, G (2) 7 = 2. Wha is he weigh of each paricle? Paricle Weigh P (S (1) 6 = 3, X (1) P (G (1) P (S (2) 6 = 0, X (2) 7 = 2, X (1) P (G (2) = E N (2 2) E G (2 2) E N (2 2) E G (2 2) = 0.30 0.50 0.30 0.50 = 0.0225 P (S (1) 6 = 3, X (1) P (G (1) 7 = 4) P (S (2) 6 = 5, X (2) 7 = 1, X (1) 7 = 4) P (G (2) = E L (4 2) E G (4 2) E N (1 2) E G (1 2) = 0.05 0.07 0.20 0.15 = 0.000105 (ii) Suppose boh cars cell phones died so you only ge he observaions G (1) 7 = 2, G (2) 7 = 2. Wha is he weigh of each paricle? Paricle Weigh P (G (1) P (G (2) = E G (2 2) E G (2 2) = 0.50 0.50 = 0.25 P (G (1) 7 = 4) P (G (2) = E G (4 2) E G (1 2) = 0.07 0.15 = 0.0105 (c) To decouple his quesion, assume ha you go he following weighs for he wo paricles. 3

Paricle Weigh 0.09 0.01 Wha is he belief for he locaion of car 1 and car 2 a = 7? Locaion P 7 ) P (X(2) 7 ) X (i) 7 = 1 0 0.09+0.01 = 0 0.01 0.09+0.01 = 0.1 X (i) 7 = 2 0.09 0.09+0.01 = 0.9 0.09 0.09+0.01 = 0.9 X (i) 7 = 4 0.01 0.09+0.01 = 0.1 0 0.09+0.01 = 0 4

Q2. Naive Bayes Your friend claims ha he can wrie an effecive Naive Bayes spam deecor wih only hree feaures: he hour of he day ha he email was received (H {1, 2,, 24}), wheher i conains he word viagra (W {yes, no}), and wheher he email address of he sender is Known in his address book, Seen before in his inbox, or Unseen before (E {K, S, U}). (a) Flesh ou he following informaion abou his Bayes ne: Graph srucure: spam H W E Parameers: θ spam, θ H,i,c, θ W,c, θ E,j,c, i {1,, 23}, j {K, S}, c {spam, ham} is a correc minimal parameerizaion. Noe ha he sum-o-one consrain on disribuions resuls in one fewer parameer han he number of seings of a variable. For insance, θ spam suffices because θ ham = 1 θ spam. Aside: a non-minimal bu correc parameerizaion was also acceped since he quesion did no ask for minimal parameers. Size of he se of parameers: 1 + 23 2 + 2 + 2 2. The size of he se is he sum of parameer sizes. Every parameer has size = number of values number of seings of is parens. For insance, θ H,i,c has 23 values of hour H and is paren c, he class, has 2. Suppose now ha you labeled hree of he emails in your mailbox o es his idea: spam or ham? H W E spam 3 yes S ham 14 no K ham 15 no K (b) Use he hree insances o esimae he maximum likelihood parameers. The maximum likelihood esimaes are he sample proporions. θ spam = 1/3, θ H,3,spam = 1, θ H,14,ham = 1/2, θ H,15,ham = 1/2, θ W,spam = 1.0, θ E,S,spam = 1, θ E,K,ham = 1 (c) Using he maximum likelihood parameers, find he prediced class of a new daapoin wih H = 3, W = no, E = U. No predicion can be made. Since E = U is never observed, i has zero likelihood under boh classes. 5

(d) Now use he hree o esimae he parameers using Laplace smoohing and k = 2. Do no forge o smooh boh he class prior parameers and he feaure values parameers. The Laplace smoohed esimae for a caegorical variable X wih parameers θ 1,,d for he {1,, d} values of X is θ i = xi+k N+kd where x i is he number of imes value i is observed, N is he oal number of observaions, and d is he number of values of X. θ spam = 3/7, θ H,3,spam = 3/49, θ H,oher,spam = 2/49, θ H,14,ham = 3/50, θ H,15,ham = 3/50, θ H,oher,ham = 2/50, θ W,spam = 3/5, θ W,ham = 2/6, θ E,S,spam = 3/7, θ E,oher,spam = 2/7, θ E,K,ham = 4/8, θ E,oher,ham = 2/8. (e) Using he parameers obained wih Laplace smoohing, find he prediced class of a new daapoin wih H = 3, W = no, E = U. Ham. The probabiliy under he model for each class is compued as he produc of he class prior and he feaure condionals: p(ham) (1 θ spam )(θ H,oher,ham )(1 θ W,ham )(1 θ E,K,ham θ E,oher,ham ) and p(spam) (θ spam )(θ H,3,spam )(1 θ W,spam )(1 θ E,S,spam θ E,oher,spam ) where boh are proporional because he disribuion has no been normalized. (f) You observe ha you end o receive spam emails in baches. In paricular, if you receive one spam message, he nex message is more likely o be a spam message as well. Explain a new graphical model which mos naurally capures his phenomena. Graph srucure: The srucure is he same as an HMM excep each hidden sae node has hree observaion child nodes. Parameers: Add 2 parameers: ransiion o spam from spam and from ham. Size of he se of parameers: Add 2 o he expression in he firs quesion. 6