Apply Bayes' theorem (#753)

Apply Bayes' theorem (#753)

Use P(Ai∣B)=P(B∣Ai)P(Ai)∑jP(B∣Aj)P(Aj)P(A_i|B) = \frac{P(B|A_i)P(A_i)}{\sum_j P(B|A_j)P(A_j)}.