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 trainslearns 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 : You will have to deal with counts that are Leaving them as zero will result in probabilities that will cause problems. A standard way to handle this is to add to all counts. For frequent feature values, it does not change things much. For infrequent values, it keeps them away from 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
