# How can I normalize Bayesian Network query result?

While taking a Bayesian network tutorial on YouTube, I was watching a video explaining the Bayesian Network probability inference. Somehow, at the end of the tutorial, the lecturer did not explain how to get the number, 0.284 in the circle in Black. I'd appreciate if somebody can explain it.

The mentioned YouTube video can be found HERE.

• Can you provide a link to the video on Youtube? Or is it private? Jun 26 '19 at 21:18

The question is phrased in a slightly confusing way, but the lecturer asks for the following (using his notation):

$$P(+b | +j, +m) = \frac{P(+b, +j, +m)}{P(+j, +m)}$$

He explains that the numerator of this fraction is equal to

$$\sum_e \sum_a P(+b, +j, +m, e, a).$$

Using the Bayesian network structure, this equals

$$\sum_e \sum_a P(+b)P(e)P(a|+b,e)P(+j|a)P(+m|a).$$

The number he calculates in his video is the term where $$e = +e$$ and $$a = +a$$.

To get the 0.284 at the end of the video, you need to compute the other three possibilities (i.e. $$e = -e$$ and $$a = +a$$, $$e = +e$$ and $$a = -a$$, $$e = -e$$ and $$a = -a$$) and add them all together. Then we need to divide by $$P(+j, +m)$$.

$$P(+b)P(+e)P(+a|+b,+e)P(+j|+a)P(+m|+a)= 0.000001197 \text{(as in the video)}$$

$$P(+b)P(-e)P(+a|+b,-e)P(+j|+a)P(+m|+a) = 0.001*0.998*0.94*0.9*0.7 = 0.0005910156$$

$$P(+b)P(+e)P(-a|+b,+e)P(+j|-a)P(+m|-a) = 0.001*0.002*0.05*0.05*0.01 = 5*10^{-11}$$

$$P(+b)P(-e)P(-a|+b,-e)P(+j|-a)P(+m|-a) = 0.001*0.998*0.06*0.05*0.01 = 0.00000002994$$

Adding these all together we get $$P(+b, +j, +m) = 0.00059224259$$.

Now we need to calculate $$P(+j, +m)$$. Unfortunately, this is even more tedious to compute, as we have the following:

$$P(+j, +m) = \sum_b \sum_e \sum_a P(b, e, a, +j, +m) =$$

$$\sum_b \sum_e \sum_a P(b)P(e)P(a|b,e)P(+j|a)P(+m|a)$$

so we need to take the expression $$P(b)P(e)P(a|b,e)P(+j|a)P(+m|a)$$, enter all possible values of $$b, e,$$ and $$a$$ and add all the results together. This is a sum with eight terms. Four of those are the same as the four that we computed before, so now let's compute the other four. These correspond to the cases when $$b = -b$$.

$$P(-b)P(+e)P(+a|-b,+e)P(+j|+a)P(+m|+a) = 0.999*0.002*0.29*0.9*0.7 = 0.0003650346$$

$$P(-b)P(-e)P(+a|-b,-e)P(+j|+a)P(+m|+a) = 0.999*0.998*0.001*0.9*0.7 = 0.00062811126$$

$$P(-b)P(+e)P(-a|-b,+e)P(+j|-a)P(+m|-a) = 0.999*0.002*0.71*0.05*0.01 = 0.00000070929$$

$$P(-b)P(-e)P(-a|-b,-e)P(+j|-a)P(+m|-a) = 0.999*0.998*0.999*0.05*0.01 = 0.000498002499$$

Now the sum of all eight terms equals $$0.002084100239$$, and thus we have

$$P(+b | +j, +m) = \frac{P(+b, +j, +m)}{P(+j, +m)} = \frac{0.00059224259}{0.002084100239} = 0.284$$

• I just guessed there must be a lot of calculations behind it, by looking at what you have provided me here looks like I wasn't that wrong. A lot of appreciations. I put this question in the video on YouTueb, so that other people with the same curiosity can see this. Jun 30 '19 at 7:41
• No worries! Glad I could help. Jun 30 '19 at 10:57