Reputation: 3616
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?
Upvotes: 2
Views: 1000
Reputation: 53758
The question is a bit off-topic and better for math, because formulas aren't supported here...
1) First, apply the definition of conditional probability:
p(R|S,W) = p(R,S,W) / p(S,W)
2) The numerator can be computed by the Law of total probability:
p(R,S,W) = p(R,S,W|C)p(C) + p(R,S,W|!C)p(!C)
and Bayesian network condition:
p(R,S,W|C) = p(W|S,R) p(S|C) p(R|C)
3) The denominator is computed likewise, but conditioning on both R
and C
:
p(S,W) = p(S,W|R,C)p(R|C)p(C) + p(S,W|R,!C)p(R|!C)p(!C) +
p(S,W|!R,C)p(!R|C)p(C) + p(S,W|!R,!C)p(!R|!C)p(!C)
Finally, each
p(S,W|R,C) = p(S,W,R,C) / p(R,C) =
p(W|S,R) p(S|C) p(R, C) / p(R,C) =
p(W|S,R) p(S|C)
This will give you all four: p(S,W|R,C)
, p(S,W|R,!C)
, p(S,W|!R,C)
and p(S,W|!R,!C)
, which in turn give p(S,W)
.
Upvotes: 1