cs221-section7

cs221-section7 - CS221 Section 7 1 CS 221 Section 7:...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS221 Section 7 1 CS 221 Section 7: Bayesian Networks 1. Chocolate Bayesian Networks Suppose you have finally graduated and have your dream job of supervising the labeling chocolate that is being produced in a factory. There are two levers controlling production, one that controls whether the chocolate is plain or almond, and another that controls whether there is coconut or not. The levers are faulty, and will randomly switch to the other position occasionally. The levers stay in the position they’re in with probability .7 and switch to the other setting .3, with each of the two lever switching independently. At the start of the day, the lever is in either setting with equal probability. You are working at the final conveyor belt and you cannot see what the levers are set to from your vantage point. You can only tell what color the chocolate is from seeing it on the converyor belt. Fortunately you do have the following table of probabilities for the color given what’s inside. Inside P(Color=Light (L) | Inside) P(Color=Dark (D) | Inside) Plain (N) 0.1 0.9 Almond (A) 0.3 0.7 Coconut (C) 0.8 0.2 Almond + Coconut (B) 0.9 0.1 You would like to know the probability that the chocolate is a certain flavor based on what you observe its color to be. In this problem we will show how a Bayesian Network can be used to help you in your task. We will let X i represent the state of the two levers at time step i , and Y i represent the observation at time step i . So, the domain of X i is { Plain (N), Almond (A), Coconut, Almond + Coconut (B) } and the domain of Y i is { Light (L), Dark (D) } . (a) Draw a Bayes Net corresponding to this situation Answer: The flavor of the chocolate at time i ( Y i ) depends only upon the position of the levers at time i ( X i ). The position of the levers at time i depends upon the position of the levers at time i- 1 , if i > 1 . If i = 1 , then each position is equally likely. We can capture this in the following network CS221 Section 7 2 (b) Suppose the first chocolate that you observe is Dark ( Y 1 = D ). What is the probability that this chocolate is coconut flavored (i.e. what is P ( X 1 = C | Y 1 = D ))? Answer: We begin by using Bayes Rule to rewrite what we want in terms of what we have. P ( X 1 = C | Y 1 = D ) = P ( Y 1 = D | X 1 = C ) P ( X 1 = C ) P ( Y 1 = D ) The terms in the numerator can be read off of our chart, but the term on the denominator takes a little more work. P ( Y 1 = D ) = X x 1 ∈ X 1 P ( X 1 = x 1 ,Y 1 = D ) = X x 1 ∈ X 1 P ( X 1 = x 1 ) P ( Y 1 = D | X 1 = x 1 ) = 0 . 25 X x 1 ∈ X 1 P ( Y 1 = D | X 1 = x 1 ) = 0 . 25 · (0 . 9 + 0 . 7 + 0 . 2 + 0 . 1) = 0 . 25 · (1 . 9) Thus, the answer we want is P ( Y 1 = D | X 1 = C ) P ( X 1 = C ) P ( Y 1 = D ) = . 2 · . 25 1 . 9 · . 25 = 0 . 2 / 1 . 9 = 0 . 105 CS221 Section 7 3 (c) Suppose that you now observe that the next chocolate is light (...
View Full Document

This note was uploaded on 12/15/2009 for the course CS 221 at Stanford.

Page1 / 7

cs221-section7 - CS221 Section 7 1 CS 221 Section 7:...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online