Training the classifier

Now, let's train a Naive Bayes classifier:

  1. First, we import the object, as follows:

  1. 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.

  1. 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).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.188.120