2
$\begingroup$

I am studying Bayesian Networks. Given that variables:
$W$: Wet grass
$R$: Rain
$S$: Sprinkler

I know the probabilities of:

$P(C)$
$P(S | C)$
$P(S | !C)$
$P(R | C)$
$P(R | !C)$
$P(W | R,S)$
$P(W | R,!S)$
$P(W | !R,S)$
$P(W | !R,!S)$

with them how can I calculate:

$P(R|W) = ?$

and

$P(R|S, W) = ?$

Here is my Bayesian Network:

enter image description here

PS: I could calculate P(S) and P(R). If anybody can just show me how to find P(R|S) I may solve this question.

$\endgroup$
3
  • $\begingroup$ I don't know the terms. Is that conditional independence or etc.? That's why I am asking this as a question because it is not clear when searching on Internet about it. $\endgroup$
    – kamaci
    Nov 10, 2012 at 18:04
  • $\begingroup$ The $|$ means conditional probability. It doesn't have anything to do with independence. $\endgroup$ Nov 10, 2012 at 19:50
  • $\begingroup$ This is worked out in the WEKA book, isn't it? $\endgroup$ Nov 17, 2012 at 15:32

2 Answers 2

3
+50
$\begingroup$

The key thing to remember here is the defining characteristic of a Bayesian network, which is that each node only depends on its predecessors and only affects its successors. This can be expressed through the local Markov property: each variable is conditionally independent of its non-descendants given the values of its parent variables. In this case, that means that $S$ and $R$ are conditionally independent given $C$: $$P(R=r\wedge S=s \;\vert\; C=c)=P(R=r \;\vert\; C=c)\cdot P(S=s \;\vert\; C=c),$$ for any truth values $r,s,c$. With this in hand, you can calculate any conditional probability you want. For example, $$ P(R|S)=\frac{P(RS)}{P(S)}=\frac{P(RS | C)P(C) + P(RS| !C)P(!C)}{P(S|C)P(C)+P(S|!C)P(!C)}=\frac{P(R|C)P(S|C)P(C)+P(R|!C)P(S|!C)P(!C)}{P(S|C)P(C)+P(S|!C)P(!C)}.$$

$\endgroup$
3
  • $\begingroup$ This looks like what exactly I want. Thanks. Can you offer me a formula for calculating P(W) with that rule? $\endgroup$
    – kamaci
    Nov 16, 2012 at 21:18
  • $\begingroup$ @kamaci: To calculate $P[W]$, you would sum over the four possible combinations of the parent variables: $P[W] = P[W|RS]P[RS] + P[W|R!S]P[R!S] + P[W|!R,S]P[!R,S]+P[W|!R,!S]P[!R,!S]$. $\endgroup$
    – mjqxxxx
    Nov 19, 2012 at 22:53
  • $\begingroup$ @mjqxxxx So does P(R|W)=(P(R,S,W)+P(R,!S,W))/P(W). And P(R,S,W)=P(W|S,R)P(S,R). And P(S,R) is calculated as above.So does P(!S,R)=P(R|C) P(!S|C)P(C)+P(R|!C)P(!S|!C)P)P(!C) $\endgroup$
    – sam_rox
    Dec 5, 2015 at 17:31
1
$\begingroup$

$P(S|W)$ isn't determined by that information. Consider the following probabilities:

$$ \begin{array}{r|cccc} &RS&!RS&R!S&!R!S\\\hline W&a&b&c&d\\ !W&e&f&g&h \end{array} $$

You know $a/(a+e)$, $b/(b+f)$, $c/(c+g)$, $d/(d+h)$ and $a+b+e+f$, and you want to know $(a+b)/(a+b+c+d)$. But we can change $c+d$ while keeping $a+b$ and everything you know fixed, and thus we can change $(a+b)/(a+b+c+d)$ while keeping everything you know fixed.

For instance, the probabilities

$$ \begin{array}{r|cccc} &RS&!RS&R!S&!R!S\\\hline W&0.1&0.1&0.1&0.2\\ !W&0.1&0.1&0.2&0.1 \end{array} $$

lead to the same given values as

$$ \begin{array}{r|cccc} &RS&!RS&R!S&!R!S\\\hline W&0.1&0.1&0.15&0.1\\ !W&0.1&0.1&0.3&0.05 \end{array} $$

but to different values of $P(S|W)$.

$\endgroup$
7
  • $\begingroup$ You say that: P(W)=P(W|R,S)+P(W|!R,S)+P(W|R,!S)+P(W|!R,!S) I got this point. However I didn't understand how could you find P(S)P(W|S) as like that? $\endgroup$
    – kamaci
    Nov 11, 2012 at 15:34
  • $\begingroup$ Apologies for the original incorrect answer; I've replaced it by one that's hopefully correct. $\endgroup$
    – joriki
    Nov 11, 2012 at 16:23
  • $\begingroup$ Is there any tutorial to explain how to rewrite P(W|R,S) with another form? $\endgroup$
    – kamaci
    Nov 11, 2012 at 18:13
  • $\begingroup$ is that equation: P(R|S) = P(S) true? $\endgroup$
    – kamaci
    Nov 11, 2012 at 18:29
  • $\begingroup$ If R and S are independent then it is true. You didn't specify in your post whether they were independent or not, though. $\endgroup$ Nov 11, 2012 at 22:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .