Now, let's train a Naive Bayes classifier:
- First, we import the object, as follows:
- Here, we train the classifier and see how it's performing on the training set:
This results in the following output:
It doesn't seem to be doing particularly well on the training set, which means that I'm not too optimistic that it's going to do well on the test set either.
- We will still run it on the test set, as follows:
This results in the following output:
We can see that it's not doing much better. This might lead us to think that a Naive Bayes algorithm is probably not the best choice; however, we could have done more to make this classifier work; for example, we could have fiddled around with some hyperparameters, such as priors. The next linear classifier we will look at is the famous support vector machine (SVM).