Assignment 6

12. Given the Bayesian network shown in Figure 5.48 (p. 321), compute the following probabilities:

a) P(B=good, F=empty, G=empty, S=yes)

P(B=good) = 1-P(B=bad) = 0.9
P(F=empty) = 0.2
P(G=empty | B=good, F=empty) = 0.8
P(S=yes | B=good,F=empty) = 1-P(S=no | B=good, F=empty) = 0.2
0.9 * 0.2 * 0.8 * 0.2 = 0.0288

b) P(B=bad, F=empty, G=not empty, S=no)

P(B=bad) = 0.1
P(F=empty) = 0.2
P(G=not empty | B=bad, F=empty) = 1-P(G=empty | B=bad, F=empty) = 1-0.9 = 0.1
P(S=no | B=bad, F=empty) = 1.0
0.1 * 0.2 * 0.1 * 1.0 = 0.002

c) Given that the battery is bad, compute the probability that the car will start.

Need: P(S=yes | B=bad)
= P(S=yes | B=bad, F=empty) + P(S=yes | B=bad, F=not empty)
= (1 - P(S=no | B=bad, F=empty)) + (1 - P(S=no | B=bad, F=not empty))
= (1 - 1.0) + (1 - 0.9)
= 0.1

13. Consider the one-dimensional data set shown in Table 5.13 (p. 322)

a) Classify the data point x=5.0 according to its 1-, 3-, 5-, and 9-nearest neighbors (using majority vote).

Table 5.13
x 0.5 3.0 4.5 4.6 4.9 5.2 5.3 5.5 7.0 9.5
y - - + + + - - + - -
d 4.5 2 0.5 0.4 0.1 0.2 0.3 0.5 2.0 4.5

1-nearest: 4.9=+, so +
3-nearest: 4.9=+,5.2=-, 5.3=-, so -
5-nearest: 4.5=+, 4.9=+,5.2=-, 5.3=-, 5.5=+(same dist as 4.5=+) so +
9-nearest: All, since the first and last have the same distance, so -

b) Repeat the previous analysis using the distance-weighted voting approach described in Section 5.2.1.

Table 5.13
x 0.5 3.0 4.5 4.6 4.9 5.2 5.3 5.5 7.0 9.5
y - - + + + - - + - -
d 4.5 2 0.5 0.4 0.1 0.2 0.3 0.5 2.0 4.5
weighted d 0.05 0.25 4 6.25 100 25 11.11 4 0.25 0.05

1-nearest: 4.9=+, so +
3-nearest: 4.9=100/+, 5.2=25/-, 5.3=11.11/-; 100>36.11, so +
5-nearest: 4.6=6.25/+, 4.9=100/+, 5.2=25/-, 5.3=11.11/-, 5.5=4/+; 110.25>36.11, so +
. 9-nearest: 3.0=0.25/-, 4.5=4/+, 4.6=6.25/+, 4.9=100/+, 5.2=25/-, 5.3=11.11/-, 5.5=4/+, 7.0=0.25/-, 9.5=0.05/-; 114.25>36.41, so +

16. a) Demonstrate how the perception model can be used to represent the AND and OR functions between a pair of Boolean variables.

y^ = sign(wdxd + wd-1xd-1... - t)
In a boolean truth table, we have two columns for X1 and X2 with a resulting Y. If Y > 0, then sign() is true (or +1), else sign() is false (or -1). In the AND case, we want each one to have equal weight, and a nothing but a perfect answer (TRUE for both terms) will suffice. Therefore, we assign a weight of 0.5 to each weight. In the case of OR, we want either term to be able to send us to +1, so we use a weight of 1 - if we end up with both terms being positive, we get 2, which sign() reduces to +1.

b) Comment on the disadvantage of using linear functions as activation functions for multilayer neural networks.

According to the book authors on p. 251, alternate activation functions exist, such as sigmoid and hyperbolic tangent functions. These other functions don't produce linear output, which allows multilayer networks to model more complex relationships between the input and output of the function.