CS827: Adv. Artificial Intelligence

Unit 6 Assignment 5, answers by: A.Aziz Altowayan


Exercise 13.8


figure question


  1. P(toothache) = 0.108 + 0.012 + 0.016 + 0.064 = 0.2

  2. P(Cavity) = 0.108 + 0.012 + 0.072 + 0.008 = 0.2

  3. P(Toothache | cavity) = toothache and cavity / cavity = (0.108 + 0.012) / 0.2 = 0.6

  4. P(Cavity | toothache ∨ catch) = cavity and (toothache or catch) / (catch or toothache) = (0.108 + 0.012 + 0.072) / 0.416 = 0.46

Exercise 13.13



Let V: Virus is present, A: test A positive, B: test B positive, we have:

P(V) = 0.01 and P(¬V) = 0.99

P(A|V) = 0.95 and P(A|¬ V) = 0.1

P(B|V) = 0.90 and P(B|¬ V) = 0.05

The question is asking about the probability of the virus when tested with both of the two tests, that is P(V|A) and P(V|B). Here, the one with higher probability should be the more indicative.

so, P(V|A) = ( 0.95 * 0.01 ) / 0.1085 = 0.088

so, P(V|B) = ( 0.90 * 0.01 ) / 0.0585 = 0.154

Therefore test B is more indicative.


Exercise 14.1



a ) Bayesian network with the Conditional Probability Table (CPT) is shown in the figure below:

b ) To answer this, we consider the following: what is the probability of getting 2 heads and 1 tail if the coin a was drawn ? so this becomes just like a conditional probability to calculate, for example, event B given A has happened, or P(B | A). Assume the event of 2 heads and 1 tail is B and drawing the coin a is A. Then this can be translated to:

To illustrate this conditional probability, imagine the following basic coin flipping trial: a biased coin (30% Head and 70% Tail) flipped 2 times, calculate the probability of getting exactly 1 head and 1 tail P(HT). Notice that the two outcomes are disjoint (outcome of first flip doesn't affect the second outcome, also order does not matter). So the result can be easily calculated as the product of the probability of head and tail: P(HT) = P(H) · P(T) = 0.30 · 0.70 = 0.21

Now back to our case, P(Head, Head, Tail | a), we can do the same calculation with a as the biased coin, since it is the considered evidence. Which gives:

and if we do the same for the other two coins b and c, we get:

So now to decide on which coin was most likely to have been drawn from the bag, we choose the coin with the highest probability of the three probabilities.

Therefore the answer is coin b.


1 ) The conditional probability P(B | A) which means probability of B given A already has happened is equal to the probability of B and A happening divided by the probability of A, that is:

Putting this to our coin example, we have:

However, since we have equal evidence "the root node in the network above" for all the three coins i.e.

P(A) is ignored in our calculations for simplicity.

2 ) Following the conventional bayesian representations, the proper way to represent these calculations would be something like:

However, once again, I decided to keep it simple.

Exercise 14.4



a ) The answer is yes they are independent.

The numerical semantic:

Two events A and B are said to be disjoint (independent) if:

In our example, we see that

P(B ∩ E) = P(E) · P(B) = 0.001 · 0.002 ≈ 0

The topological semantic:

from the network graph we see that B and E are separated by A, hence they are conditionally independent. See AIMA: 14.2.2

b ) Two variables A and B are called conditionally independent, if

Since, the alarm is true "A = t", so we need to calculate the probabilities of B = t and E = t given that the alarm is true, and show that: