# Bayesian network conditional independency

If we observe that it is cloudy and raining. What is the probability that the grass is wet? The answer would be:

P(W=T|C=T,R =T) = P(W=T|R=T,S=T)*P(S=T|C=T)+P(W=T|R=T,S=F)*P(S=F|C=T)


But if we observe that the sprinkler is on and the grass is wet, then what would be the probability that it is raining? I'm not sure what would be the solution query to this problem?

• If it is homework, please tag it as self-study Jan 3, 2018 at 15:10
• @jpmuc It's a group of self-study questions.
– Tak
Jan 3, 2018 at 15:56

You first need to work out what the probability of the model is, $$P(W, S, R, C) = P(W|S, R)P(S|C) P(R|C)P(C)$$ Then you ask for, $$P(R=1|S=1, W=1)$$
Now, $$P(R|S,W) = \frac{P(S, W|R)P(R)}{P(S,W)}$$ Let us first consider the numerator, $$P(S, W|R)P(R) = \\ P(W|R, S)P(R)P(S|R) = \\ P(W|R, S)P(R,S) = \\ P(W|R, S)\sum_{C}P(R|C)P(S|C)P(C)$$ Similarly, $$P(S,W) = \sum_{R}P(W|R,S) \sum_{C}P(R|C)P(S|C)P(C) = \\ \sum_{C} P(S|C)P(C) \sum_{R}P(W|R,S) P(R|C)$$