# CS533 --- Written Homework 4 --- Solutions

Consider the following belief network:

The following tables give the conditional probability tables (CPTs) in each node:
P(A)
A=0 A=1
0.4 0.6

 P(B|A) A B=0 0 1.0 0.0 1 0.5 0.5

 P(C|A) A C=0 0 0.2 0.8 1 0.3 0.7

 P(D|B,C) B C D=0 0 0 0.0 1.0 0 1 1.0 0.0 1 0 0.4 0.6 1 1 0.6 0.4

1. Write an algebraic expression for the joint probability distribution P(A,B,C,D) in terms of the probability distributions stored in each node.

```        P(A,B,C,D) = P(A) * P(B|A) * P(C|A) * P(D|B,C)
```

2. Fill in the following table for the joint probability distribution.

C=0 C=1
D=0 D=1 D=0 D=1
A=0 B=0 0 0.08 0.32 0
B=1 0 0 0 0
A=1 B=0 0 0.09 0.21 0
B=1 0.0360.054 0.126 0.084

3. Write an algebraic expression for the probability distribution P(D) in terms of the probability distributions stored in each node.

We need to take the joint distribution P(A,B,C,D) and sum over A, B, and C. By grouping all of the terms involving A, we can sum over it first, and then multiply the resulting values by P(D|B,C) and sum over B and C.

```        SUM[B] SUM[C] P(D|B,C) * (SUM[A] P(A) * P(B|A) & P(C|A))
```

4. Compute the numerical value of P(D=0).
```        P(D=0) =  0 + .32 + 0  + 0 + 0 + .21 + .036 + .126
=  0.692
```

5. Write an algebraic expression for the probability distribution P(B|D) in terms of the probability distributions stored in each node.
```            SUM[A] P(A) * P(B|A) * (SUM[C] P(C|A) * P(D|B,C))
----------------------------------------------------------
SUM[A] P(A) * (SUM[B] P(B|A) * (SUM[C] P(C|A) * P(D|B,C)))
```

6. Compute the numerical value of P(B=0|D=0).
```        P(B=0|D=0) = P(B=0, D=0) / P(D=0) = 0.53 / 0.692 = .7659
```