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

## Ch.13

Exercise 13.8

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

Question:

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.

• P(V|A) = P(A|V) P(V) / P(A)

• P(A) = P(A|V) P(V) + P(A|¬V) P(¬V) = 0.0095 + 0.099 = 0.1085

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

• P(V|B) = P(B|V) P(V) / P(B)

• P(B) = P(B|V) P(V) + P(B|¬V) P(¬V) = 0.009 + 0.0495 = 0.0585

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

Therefore test B is more indicative.

## Ch.14

Exercise 14.1

Question:

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:

• P( HHT | a) = P(H) · P(H) · P(T) = 0.2 · 0.2 · 0.8 = 0.032

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

• P( HHT | b) = 0.6 · 0.6 · 0.4 = 0.144
• P( HHT | c) = 0.8 · 0.8 · 0.2 = 0.128

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.

Note:

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:

• P(B | A ) = P(B ∩ A) / P(A)

Putting this to our coin example, we have:

• P(HHT | a) = P(HHT ∩ a) / P(a)

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

• P(C = a) = P(C = b ) = P(C = c) = 1/3

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:

• P(X1=H, X2=H, X3=T | C=a)

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

Exercise 14.4

Question:

a ) The answer is yes they are independent.

The numerical semantic:

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

• P(A ∩ B) = 0

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

• P(A, B | C) = P(A | C) · P(B | C)

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:

• P(B, E | A) = P(B | A) · P(E | A)