CS 188 Sp07 Discussion Note Week 6 Game and Discrete Probability

Total Page:16

File Type:pdf, Size:1020Kb

CS 188 Sp07 Discussion Note Week 6 Game and Discrete Probability

CS 188 Sp07 Discussion Note Week 7 – Discrete Probability and Bayesian Network by Nuttapong Chentanez

Probability Independence X and Y are independent if P(X,Y) = P(X)P(Y), equivalently P(X) = P(X|Y) Sample Space – Set of all possible outcome of some experiment Conditional independent Random Variables – Function that assign a value to each outcome in a sample X and Y are conditional independent given Z if P(X,Y|Z) = P(X|Z) P(Y|Z) space Exercise: Show that the above is equivalent to P(X|Y,Z) = P(X|Z) eg. If sample space S is the set of all students in this class, one could define a random variable A, measuring age. If p is a person, A(p) is his/her age. Chain rules n

P(x1, x2, …, xn) = P(xn|xn-1,…..,x1)P(xn-1,…, x1) =  P(xi|xi-1,….,x1) Event - a set of outcomes that share property you are interested in. eg. For i=1 sample space S, J may be the set of juniors. Randomly picking a person may pr Bayes’s Nets may not result in the event that he/she is a junior. P(J) denotes the probability A set of random variables as nodes (discrete or continuous) that the event J occurs. A set of directed links or arrows connects pairs of nodes.

Events can be union, intersects, complement to define new events. Particular Each node Xi has a conditional probability distribution P(Xi|Parents(Xi)) conditions on random variables such as A=6’1”, A<7’ can also be considered an Graph has no directed cycle, directed acyclic graph (DAG) event.

Conditional Probability – P(X|Y) = P(X  Y) / P(Y) is probability that event X occurs given that event Y occurs

Joint Distribution – P(A = a, B = b) denotes probability that A = a and B = b

Marginal Distribution – P(A = a) =  P(A = a, B = b) This summation is called “marginalization” b Conditional distribution – P(A = a| B = b) gives conditional probability

Important Rules: Chain Rules: P(X, Y) = P(X|Y)P(Y) The topology imply certain conditional independencies: Bayes’s Rule: P(X|Y) = P(Y|X) P(X) / P(Y), very useful in AI P(Xi|Xi-1,….X1) = P(Xi| Parents(Xi)) Axioms of probability Given that Parents(Xi)  {Xi-1, … , X1} 1. 0<= P(a) <= 1, for any proposition a, 2. P(true) =1 , P(false) = 1 Combined with chain rule, we can write full joint probability as: 3. P( a  b) = P(a) + P(b) – P(a  b) n P(X1, …Xn) =  P(Xi|Parents(Xi)), i=1 Exercise: 1. Show P(a| a  b) = 1 using the partial ordering implied by the DAG

2. Consider the problem of dealing 5-card poker hands from a standard Given a set of random variables, the correct order for constructing Bayes’s net is deck of 52 cards, assuming that the dealer is fair. by adding “root causes” first, then the variables they influence and so on. a. How many atomic events are there in the joint probability distribution (how many 5-card hands are there)? This is because parents of a node are “direct influencers” of the node. b. What is the probability of each atomic event? c. What is the probability of dealt a royal straight flush? Four Directed edges need not be causality, but constructing of a kind? the graphs with causality in mind tend to make the graph has less edges. Example is adding M, J, A, B, E will have more edges. Also it’s more difficult to collect data. 3. From this table: Toothache ~ Toothache Catch ~Catch Catch ~Catch Cavity 0.108 0.012 0.072 0.008 Independence in BN: Are two nodes conditionally independent given certain evidences? ~Cavity 0.016 0.064 0.144 0.576 Causal Chain Compute Are X and Z always independent? a. P(toothache) X Y Z Are X and Z independent given Y? b. P(Cavity) c. P(Toothache| cavity) d. P(Cavity| toothache  catch) Common Cause Y X = Newsgroup busy, Y = Project due, Z = Lab full Is X and Z independent given Y? X Z

4. After your yearly checkup, the doctor has bad news and good news. CommonThe Effect bad news is that you tested positive for a serious disease and the test is 99% accurate (for instance, The probability of testing positive when you have the X Z X: CS188 project due, Z: CS184 project due, Y: disease is 0.99). The good news is that this is a rare disease, striking only 1 in Lack of sleep 100,000 people of your age. Why is it a good news that the disease is rare? What Is X and Z independent? is the chance that you actually have the disease? Is X and Z independent given Y? General Case: Y Bayes Ball Algorithm : 2.

A simple Bayes net with Boolean variables I = Intelligent, H =Honest, P =Popular, L=LotsOfCampaignFunds, E =Elected. Example a. Which of the followings are asserted by the network (ignoring CPT)? L

R B

b. Calculate P(i, h, ~l, p, ~e)

D T

c. Calculate the probability that someone is intelligent given that they are honest, have few campaign funds, and are elected. T ’

Exercise: d. True/False If there are two candidates in the race, then making two copies of 1. The Surprise Candy Company makes candy in two 70% are strawberry and the network will correctly represent the joint distribution over the two sets of 30% are anchovy. Each new piece of candy starts out with a round shape; as it variables. moves along the production line, a machine randomly selects a certain percentage to be trimmed into a square; then, each piece is wrapped in a wrapper whose color is chosen randomly to be red or brown. 80% of the strawberry candies are round and 80% have a red wrapper, while 90% of the anchovy 3. candies are square and 90% have a brown wrapper. All candies are sold individually in sealed, identical, black boxes. Now you, the customer, have just bought a Surprise candy at the store but have not yet opened the box. Consider these three Bayes nets:

a. Which network(s) can correctly represent P (Flavor, Wrapper, Shape)? b. Which network is the best representation for this problem? c. True/False: Network (i) asserts that P (Wrapper | Shape) =P (Wrapper). d. What is the probability that your candy has a red wrapper? (i) 0.8 (ii) 0.56 (iii) 0.59 Is X2  X3 | {X1, X6}? How about X1  X6 | {X2, X3}?

e. In the box is a round candy with a red wrapper. The probability that its flavor is strawberry (i)0.7 (ii) Between 0.7 and 0.99 (iii) > 0.99

Recommended publications