0
$\begingroup$

I have the following Bayes network:

S R
\ / 
 H

I know that: $$ P(s) = .7$$$$ P(r) = .01$$$$ P(h|s,r) = 1$$$$ P(h|!s,r) = .9$$$$ P(h|s,!r) = .7$$$$ P(h|!s,!r) = .1$$$$ $$ and I would like to find $p(r|h,s), p(r|h), p(r|h,!s)$.

I can imitate the explanation I received to solve this problem but it doesn't feel like I really understand it, so I decided to figure it out for myself. I think I get a reasonable solution but for some reason it is not the right one. This suggests that I misunderstand something and I am hoping somebody can nudge me in the right direction.

My first goal was to explore the space:
$$ P(!s) = .3$$$$ P(!r) = .99$$$$ $$ Then to relate the conditional probabilities to the likelihood of them happening:
$$ P(h,s,r) = p(h|s,r) * P(s) * P(r) = 0.007$$$$ P(h,!s,r) = p(h|!s,r) * P(!s) * P(r) = 0.0027$$$$ P(h,s,!r) = p(h|s,!r) * P(s) * P(!r) = 0.4851$$$$ P(h,!s,!r) = p(h|!s,!r) * P(!s) * P(!r) = 0.00099$$$$ $$ and to sum them up to find all the probabilities of h $p(h): .49579$
(I use an excel sheet for my calculation to limit impreciseness)
$$ a = P(h,s,r)/P(h) = 0.01412$$$$ b = P(h,!s,r)/P(h) = 0.00545$$$$ c = P(h,s,!r)/P(h)= 0.97844$$$$ d = P(h,!s,!r)/P(h)= 0.001997$$$$ $$ now I know the likelihood of each scenario happening. I used variables a,b,c,d because it seems clearer:
$$ P(r|h,s) = a/(a+c) = 0.14225 $$$$ P(r|h) = (a+b)/(a+b+c+d) = 0.01956 $$$$ P(r|h,!s)= b/(b+d) = 0.7317 $$$$ $$ I would really appreciate it if somebody can point out the flaw in my thinking,
Thank you,

Boaz

ps. This question is taken from a udacity course intro to AI where it is solved using Bayes Theorem.

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Your notation of p'(h|s,r) is confusing. Simply use p(h,s,r)= p(h|s,r)*p(s)*p(r)

Then $p(r|h,s) $ $= p(h,s,r)/p(h,s) \\ = p(h,s,r)/[p(h,s,r)+p(h,s,!r)] \\ = p(h|s,r)\cdot p(r)\Big/[p(h|s,r)\cdot p(r)+p(h|s,!r)\cdot p(!r)] \\ = 1\cdot 0.01 / [1\cdot 0.01 + 0.7\cdot 0.99] \\ = 0.01422475106685633001422475106686...$

And $p(r|h,!s) $ $= p(h|!s,r)\cdot p(r)\Big/[p(h|!s,r)\cdot p(r)+p(h|!s,!r)\cdot p(!r)] \\ = 0.9\cdot 0.01 / [0.9\cdot 0.01 + 0.1\cdot 0.99] \\ = 0.08333333333333333333333333333333...$

And $p(r|h) = \frac{p(h|s,r)p(s)p(r)+p(h|!s,r)p(!s)p(r)}{p(h|s,r)p(s)p(r)+p(h|!s,r)p(!s)p(r)+p(h|s,!r)p(s)p(!r)+p(h|!s,!r)p(!s)p(!r)}$ ... and so on.

$\endgroup$
2
  • $\begingroup$ Graham, if I could have another moment of your time, my second answers are different than what udacity offered, the first one may be a rounding error but the second one must be a mistake...? expected: p(r|h) = 0.0185 and I got 0.01956 , and expected p(r|h,!s) = 0.0833 and I got 0.7317073171. $\endgroup$
    – BJR
    Nov 18, 2015 at 0:10
  • $\begingroup$ @BJR Look to your fourth calculation. $p(h\mid !s,!r)\cdot p(!s)\cdot p(!r) = 0.1\cdot 0.3\cdot 0.99 = 0.0297 \;\color{red}{\neq 0.00099}$ $\endgroup$ Nov 18, 2015 at 0:30

You must log in to answer this question.

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