All logs are to base 2. ************ Computing Probabilities from Training Set ****************** Word Go Mu Wr -log(P(W|Go)) -log(P(W|Mu)) -log(P(Word|Wr)) activist 1 0 0 1.0000 3.5850 3.5850 american 1 1 0 1.0000 1.0000 3.5850 artist 0 1 0 3.5850 1.0000 3.5850 composer 0 2 0 3.5850 0.1255 3.5850 conductor 0 1 0 3.5850 1.0000 3.5850 english 0 1 0 3.5850 1.0000 3.5850 french 1 0 1 1.0000 3.5850 0.1255 general 1 0 0 1.0000 3.5850 3.5850 journalist 0 0 1 3.5850 3.5850 0.1255 lawyer 1 0 0 1.0000 3.5850 3.5850 music 0 1 0 3.5850 1.0000 3.5850 novelist 0 0 1 3.5850 3.5850 0.1255 pianist 0 1 0 3.5850 1.0000 3.5850 philosopher 0 0 1 3.5850 3.5850 0.1255 politician 1 0 0 1.0000 3.5850 3.5850 representative 1 0 0 1.0000 3.5850 3.5850 social 1 0 0 1.0000 3.5850 3.5850 theorist 0 1 0 3.5850 1.0000 3.5850 writer 0 1 0 3.5850 1.0000 3.5850 Go Mu, Wr -log(P(Go)) -log(P(Mu)) -log(P(Wr)) 2 2 1 1.3785 1.3785 2.1155 ************ Applying Probabilities to Test Set ****************** Disraeli politician novelist Category Total Go 1.0000 3.5850 1.3785 5.9635 Mu 3.5850 3.5850 1.3785 8.5485 Wr 3.5850 0.1255 2.1155 5.8260 Prediction: Writer. Wrong. Actual probabilities Let a = 5.9635, b=8.5485, c=5.8260. c is the smallest. Let x = 2^(c-a) = 0.9091 y=2^(c-b) = 0.1515 z=2^(c-c) = 1.0 P(Go|Disraeli) = x/(x+y+z) = 0.4412. P(Mu|Disraeli) = y/(x+y+z) = 0.0735. P(Wr|Disraeli) = z/(x+y+z) = 0.4853. Eliot English novelist journalist Category Total Go 3.5850 3.5850 3.5850 1.3785 12.1134 Mu 1.0000 3.5850 3.5850 1.3785 9.5485 Wr 3.5850 0.1255 0.1255 2.1155 5.9515 Prediction: Writer. Right Actual probabilities Let a = 12.1134, b=9.5485, c=5.9515. c is the smallest. Let x = 2^(c-a) = 0.0138 y=2^(c-b) = 0.0826 z=2^(c-c) = 1.0 P(Go|Eliot) = x/(x+y+z) = 0.0126. P(Mu|Eliot) = y/(x+y+z) = 0.0754. P(Wr|Eliot) = z/(x+y+z) = 0.9121. Jordan american politician activist Category Total Go 1.0000 1.0000 1.0000 1.3785 4.3785 Mu 1.0000 3.5850 3.5850 1.3785 9.5485 Wr 3.5850 3.5850 3.5850 2.1155 12.8704 Prediction: Government: Right. Actual probabilities Let a = 4.3785, b=9.5485, c=12.8704 a is the smallest. Let x = 2^(a-a) = 1.0000 y=2^(a-b) = 0.0278 z=2^(a-c) = 0.0028 P(Go|Jordan) = x/(x+y+z) = 0.9704. P(Mu|Jordan) = y/(x+y+z) = 0.0270. P(Wr|Jordan) = z/(x+y+z) = 0.0027. Schumann composer pianist Category Total Go 3.5850 3.8580 1.3785 8.5485 Mu 0.1255 1.0000 1.3785 2.5041 Wr 3.5850 3.5850 2.1155 9.2854 Prediction: Music. Right Actual probabilities Let a = 8.5485, b=2.5041, c=9.2854 b is the smallest. Let x = 2^(b-a) = 0.0152 y=2^(b-b) = 1.0000 z=2^(b-c) = 0.0089 P(Go|Schumann) = x/(x+y+z) = 0.0148. P(Mu|Schumann) = y/(x+y+z) = 0.9763. P(Wr|Schumann) = z/(x+y+z) = 0.0089. Overall accuracy: 3/4 = 0.75