**Unformatted text preview:**

CS 188Fall 2019 Section Handout 7 SolutionsProbabilityA random variable represents an event whose outcome is unknown. A probability distribution is anassignment of weights to outcomes A joint distribution over discrete random variables is a table of probabilitieswhich captures the likelihood of each possible outcome, also known as an assignment of values to the randomvariables.To write that random variables X and Y are marginally independent, we write X ⊥⊥ Y . To write that randomvariables X and Y are conditionally independent given another random variable Z, we write X ⊥⊥ Y |Z.Bayesian Network RepresentationIn a Bayesian network, rather than storing information in a giant table, probabilities are instead distributedacross a large number of smaller local probability tables along with a directed acyclic graph (DAG) whichcaptures the relationships between variables. Thus, if we have a node representing variable X, we storeP (X|A1, A2, ..., AN), where A1, ..., ANare the parents of X.• Each node is conditionally independent of all its ancestor nodes (non-descendents) in thegraph, given all of its parents.• Each node is conditionally independent of all other variables given its Markov blanket. Avariable’s Markov blanket consists of parents, children, children’s other parents.Q1. Bayes’ Nets: Representation and IndependenceParts (a) and (b) pertain to the following Bayes’ Net.1A BC D EF G(a) Express the joint probability distribution as a product of terms representing individual conditional prob-abilities tables associated with the Bayes Net.P (A)P (C|A)P (B|A)P (D|B)P (E)P (F |D, E)P (G|D)(b) Assume each node can take on 4 values. How many entries do the factors at A, D, and F have?A: 4D: 42F: 43You are building advanced safety features for cars that can warn a driver if they are falling asleep (A) and alsocalculate the probability of a crash (C) in real time. You have at your disposal 6 sensors (random variables):• E: whether the driver’s eyes are open or closed• W : whether the steering wheel is being touched or not• L: whether the car is in the lane or not• S: whether the car is speeding or not• H: whether the driver’s heart rate is somewhat elevated or resting• R: whether the car radar detects a close object or notA influences {E, W, H, L, C}. C is influenced by {A, S, L, R}.(c) Draw the Bayes Net associated with the description above by adding edges between the provided nodeswhere appropriate.A S RE W H L C2Q2. Bayes’ Nets Representation and ProbabilitySuppose that a patient can have a symptom (S) that can be caused by two different diseases (A and B). Itis known that the variation of gene G plays a big role in the manifestation of disease A. The Bayes’ Net andcorresponding conditional probability tables for this situation are shown below. For each part, you may leaveyour answer as an arithmetic expression.P(G)+g 0.1−g 0.9P(A|G)+g +a 1.0+g −a 0.0−g +a 0.1−g −a 0.9A G S B P(B)+b 0.4−b 0.6P(S|A, B)+a +b +s 1.0+a +b −s 0.0+a −b +s 0.9+a −b −s 0.1−a +b +s 0.8−a +b −s 0.2−a −b +s 0.1−a −b −s 0.9(a) Compute the following entry from the joint distribution:P(+g, +a, +b, +s) =P(+g)P(+a| + g)P(+b)P(+s| + b, +a) = (0.1)(1.0)(0.4)(1.0) = 0.04(b) What is the probability that a patient has disease A?P(+a) = P(+a| + g)P(+g) + P(+a| − g)P(−g) = (1.0)(0.1) + (0.1)(0.9) = 0.19(c) What is the probability that a patient has disease A given that they have disease B?P(+a| + b) = P(+a) = 0.19 The first equality holds true as we have A ⊥⊥ B, which canbe inferred from the graph of the Bayes’ net.The figures and table below are identical to the ones on the previous page and are repeated here for yourconvenience.(d) What is the probability that a patient has disease A given that they have symptom S and disease B?P(+a| + s, +b) =P(+a,+b,+s)P(+a,+b,+s)+P(−a,+b,+s)=P(+a)P(+b)P(+s|+a,+b)P(+a)P(+b)P(+s|+a,+b)+P(−a)P(+b)P(+s|−a,+b)=(0.19)(0.4)(1.0)(0.19)(0.4)(1.0)+(0.81)(0.4)(0.8)=0.0760.076+0.2592≈ 0.2267(e) What is the probability that a patient has the disease carrying gene variation G given that they havedisease A?P(+g| + a) =P(+g)P(+a|+g)P(+g)P(+a|+g)+P(−g)P(+a|−g)=(0.1)(1.0)(0.1)(1.0)+(0.9)(0.1)=0.10.1+0.09= 0.5263(f) What is the probability that a patient has the disease carrying gene variation G given that they have3disease B?P(+g| + b) = P(+g) = 0.1 The first equality holds true as we have G ⊥⊥ B, which can beinferred from the graph of the Bayes’

View Full Document