Building a Naive Bayes Text Classifier with scikit-learn


Follow to receive video recommendations   a   A

Machine learning algorithms used in the classification of text are Support Vector Machines, k Nearest Neighbors but the most popular algorithm to implement is Naive Bayes because of its simplicity based on Bayes Theorem.

The Naive Bayes classifier is able to memorise the relationships between the training attributes and the outcome and predicts by multiplying the conditional probabilities of the attributes with the assumption that they are independent of the outcome. It is popularly used in classifying data sets that have a large number of features that are sparse or nearly independent such as text documents.

In this talk, I will describe how to build a model using the Naive Bayes algorithm with the scikit-learn library using the spam/ham youtube comment dataset from the UCI repository. Preprocessing techniques such as Text normalisation and Feature extraction will be also be discussed.

Editors Note:

If you like this website, please upvote my Awesome Python pull request.