Ai HW-4
Ai HW-4
P(+m | G) P(-m | G)
+g 0.667 0.333
-g 0.25 0.75
M
G M P(G,
+g +m M)
+g -m
-g +m
-g -m
b) What is P(+m) ?
c) P(+g | +m) ?
Compute the following quantities. You may use either the full joint distribution
or the conditional tables, whichever is more convenient.
a) P(+b | +m) =
c) P(+b) =
d) P(+c | +b) =
Based on the structure, which of the following are guaranteed to be true, and which are
guaranteed to be false?
(a) B ⊥G
(b) C ⊥ G | M
(c) G ⊥ S
(d) G ⊥ S | M
(e) G ⊥ S | B
(f) B ⊥ C
(g) B ⊥ C | G
Sampling and Dynamic Bayes Nets
Many people would prefer to eat ice cream on a sunny day than on a rainy day. We can model
this situation with a Bayesian network. Suppose we consider the weather, along with a person's
ice-cream eating, over the span of two days. We'll have four random variables: W 1 and W2 stand
for the weather on days 1 and 2, which can either be rainy R or sunny S, and the variables I 1 and
I2 represent whether or not the person ate ice cream on days 1 and 2, and take values T (for truly
eating ice cream) or F.
1. Suppose you decide to assume for modeling purposes that the weather on each day might
depend on the previous day's weather, but that ice cream consumption on day i is
independent of ice cream consumption on day i-1, conditioned on the weather on day i .
Draw a Bayes net encoding these independence assumptions.
W 2 = S W2 = R I=T I=F
W 1 = S W1 = R
W1 = S .7 .3 W=S .9 .1
.6 .4
W1 = R .5 .5 W=R .2 .8
(a) P(W1)
(b) P(W2 | W1) (c) P(I | W)
Together with the graph you drew above, these distributions fully specify a joint probability
distribution for the four variables. Now we want to do inference, and in particular we'll try
approximate inference through sampling. Suppose we sample from the prior to produce the
following samples of (W1; I1; W2; I2) from the ice-cream model:
R, F, R, F R, F, R, F S, F, S, T S, T, S, T S, T, R, F
R, F, R, T S, T, S, T S, T, S, T S, T, R, F R, F, S, T
(c) What is ^
P(W2 = R), the probability that sampling assigns to the event W2 = R?
(d) Cross off samples rejected by rejection sampling if we're computing P(W2|I1 =T;I2= F)
(W1; I1; W2; I2) = { <S; T; R; F>; <R; T; R; F>; <S; T; R; F>; <S; T; S; F>; <S; T; S; F>; <R; T;
S; F> }
Variable Elimination
For the Bayes' net below, we are given the query P (Y | +z). All variables have binary domains.
b) What is the size of the largest factor that gets generated during the above process?
c) Does there exist a better elimination ordering (one which generates smaller largest
factors)?