Question: Complete the two functions in the two cells below. The first trains / learns a naive Bayes classifier. The second predicts the classes for a

Complete the two functions in the two cells below.
The first trains/learns a naive Bayes classifier. The second predicts the classes for a set of examples based on the model learned.
Hint: You'll need to generate the data matrix yourself and your own testing examples.
Hint 2: You will have to deal with counts that are 0. Leaving them as zero will result in 0 probabilities that will cause problems. A standard way to handle this is to add 1 to all counts. For frequent feature values, it does not change things much. For infrequent values, it keeps them away from 0 and admits that they might happen more often

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!