From the course: Text Analytics and Predictions with Python Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Naïve Bayes classification

Naïve Bayes classification - Python Tutorial

From the course: Text Analytics and Predictions with Python Essential Training

Start my 1-month free trial

Naïve Bayes classification

- [Instructor] Now that we have our data prepared and ready to go, we can build a classification model for the code's descriptions. First, we load up the pre-tag classes for each of the course descriptions from the Course-Classification.txt file. Then we will use a label encoder to code these text class names into equivalent numeric values. Let us execute this code. When we print them, we see three unique classes, Cloud-Computing, Data-Science and Programming. In addition, we also see the equivalent numeric values for each of the 20 descriptions. To build a classification model, we use the Multinominal naive_bayes algorithm. This is just a demonstration with one of the available classification algorithms found in Python. We split the feature data as well as the class target variables into training and test datasets. We then build a classifier with the training feature dataset and the target dataset. In the next video, we are going to run predictions with this classifier.

Contents