Exercise 4.18 - Naive Bayes with mixed features

Answers

For question (a):

p ( y = 1 | x 1 = 0 , x 2 = 0 ) = p ( y = 1 ) p ( x 1 | y = 1 ) p ( x 2 = 0 | y = 1 ) p ( x 1 = 0 , x 2 = 0 ) = 0.5 0.5 exp ( 0.5 ) 2 π p ( x 1 = 0 , x 2 = 0 ) .

Similarly,

p ( y = 2 | x 1 = 0 , x 2 = 0 ) = 0.25 0.5 1 2 π p ( x 1 = 0 , x 2 = 0 ) ,

p ( y = 3 | x 1 = 0 , x 2 = 0 ) = 0.25 0.5 exp ( 0.5 ) 2 π p ( x 1 = 0 , x 2 = 0 ) .

A normalization yields the final result by eliminating p ( x 1 = 0 , x 2 = 0 ) .

For question (b), we have:

p ( y = 1 | x 1 = 0 ) = 0.5 ,

p ( y = 2 | x 1 = 0 ) = 0.25 ,

p ( y = 3 | x 1 = 0 ) = 0.25 ,

since x 1 yields no more information for the classification label.

For question (c), we have:

p ( y = 1 | x 2 = 0 ) 0.5 exp ( 0.5 ) 2 π ,

p ( y = 2 | x 2 = 0 ) 0.25 1 2 π ,

p ( y = 3 | x 2 = 0 ) 0.25 exp ( 0.5 ) 2 π .

One can observe that unlike p ( y | x 1 = 0 ) , p ( y | x 1 = 0 ) is different from the prior on labels.

User profile picture
2021-03-24 13:42
Comments