Question: Implement Bernoulli Naive Bayes classification model as described above and test it on toy example provided in this resource. Your program should read training data

Implement Bernoulli Naive Bayes classification model as described above and test it on toy example provided in this resource. Your program should read training data and corresponding class information from these 2 files: toy.data.txt and toy.class.txt. Note that the file toy.class.txt file contains labels 1 and 0, where 1 indicates the class S and 0 indicates the class I. Use the training data to compute prior probabilities p(S) and p(I) and to compute the likelihood probabilities p(wt | C = k) where k = S, I and t = 1 through 8 (because the toy example has 8 words).

Your program should then read two test cases from toytest.data.txt and output the posterior probability p(S | Dtest) and p(I | Dtest) for each of them, as follows:

Test case 1  p(S|b) = 0.00561167  p(I|b) = 9.30909e-06 Test case 2  p(S|b) = 0.000280584  p(I|b) = 0.00804306 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!