The derivation of Bayes formula:
P(A | B) = P(A & B) / P(B)
Using some algebra, this equation can be rewritten as:
P(A & B) = P(A | B) P(B)
The same right-hand value can also be computed using A as the conditioning variable:
P(A & B) = P(B | A) P(A)
Given this equivalence, you can write:
P(A | B) P(B) = P(B | A) P(A)
Simplifying, you arrive at Bayes theorem:
P(A | B) = P(B | A) P(A) / P(B)
Now that we have Bayes formula we can begin to calculate the inference by enumeration.
p(b | a):
First thing we need to do is rewrite this equation using bayes formula:
= p(b, a) / [p(b, a) + p(¬b, a)]
Next we need to calculate the probablity of p(b,a)
p(b, a) = p(b)[p(e)p(a | b, e) + p(¬e)p(a | b, ¬e)]
All of these values we can pull directly from the tables given in the alarm network.
= .001(.002*.95 + .998*.94) = 0.00094
Now, we need to caclulate the probability of p(¬b, a):
p(¬b, a)= p(¬b)[p(e)p(a | ¬b, e) + p(¬e)p(a | ¬b, ¬e)]
Once again we can pull these values from the table.
= .999(.002*.29+.998*.001) = 0.00158
Now, after calculating these probabilities we can finally calculate the final result:
= 0.00094 / (0.00094 + 0.00158) = 0.373
To help solidify this we will run through one more example using our alarm network:
p(b | e, a) = p(b, a, e) / [p(b, a, e) + p(¬b, a, e)]
p(b, a, e) = p(b)p(e)p(a | b, e)
= .001(.002*.95 ) = 0.0000019
p(¬b, a, e)= p(¬b)p(e)p(a | ¬b, e)
= .999(.002*.29) = 0.000579
= 0.0000019/ (0.0000019+ 0.000579) = 0.003
That is how we compute inference by enumeration.