Finding Probability of P(S|W) at Bayesian Network of Rain Problem 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:

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.
 A: 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)}.$$
A: $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)$.
