The new generation of people would probably never have to experience the stress of parsing through tons of emails, only to realise they are full of spam. Now, when you log into your email it’s highly likely that your email providers have implemented a form of filtering that automatically places all the spam emails into a separate spam folder. This phenomena is known as spam filtering, but there are other features, some being more subtle to the untrained eye such as text classification which involves assigning categories to unstructured text, or analysing the sentiment of messages from twitter.
Many of these tasks have been made possible as a result of Machine Learning, and a popular Machine Learning algorithm called the Naive Bayes Classifier has played a great part.
What is Naive Bayes?
The Naive Bayes classifier is part of a family of very simple probabilistic classifiers that are based on Bayes Theorem. The classifier earned the name “Naive Bayes” – in some texts it’s also referred to as “Idiot Bayes” – as a result of the calculations for each class being simplified so that they are tractable. Essentially, the Naive Bayes model is a conditional probability classification with Bayes Theorem applied.
Conditional probability defines the probability of an event occurring given the occurrence of another event. Another interesting thing we could do with the conditional probability is use it to calculate the joint probability – which is the probability of two or more simultaneous events. On the flip side, the joint probability could also be used to calculate the conditional probability, but it’s often quite difficult to calculate the joint probability hence we use Bayes Theorem to calculate the conditional probability.
There are 3 main types of learning problems in Machine Learning:
- Supervised Learning
- Unsupervised Learning
- Reinforcement Learning
The Naive bayes algorithm is generally used for supervised learning tasks; Supervised learning could be further broken down into regression tasks, of which the model would learn to predict continuous values, or classification tasks where the model learns to predict a category/class – Naive Bayes falls into the category of classification algorithms.
Naive Bayes Use Cases
Although the assumption made by the Naive Bayes classifier that each input is independent of all other variables, which is a strong assumption given that it is very unlikely that variables do not interact in real-world data, the Naive Bayes generally performs quite well on various tasks. For instance:
- Document Classification: The task of document classification involves assigning a document to one or more classes or categories for example classifying a news article into sport, business, politics, etc. categories. This also involves spam classification.
- Real-Time Prediction: As it’s an eager learning classifier, the Naive Bayes algorithm is very fast hence it could be used to make predictions in real time.
- Multi-class Prediction: The task of classifying instances into one of three or more classes.
- Sentiment Analysis: Sentiment analysis falls under Natural Language processing techniques. The idea is to determine whether data has positive or negative sentiment.
Pros of the Naive Bayes Classifier
- Naive Bayes is a simple model and is very easy to implement. It also makes predictions very quickly and can work for multi-class prediction tasks (A supervised classification task in which there are more than 2 classes)
- It works well with data with lots of features such as text classification and email spam detection.
- It doesn’t require a lot of training data to learn interesting insights, and could perform much better than complex machine learning models when the data set is small.
Cons of the Naive Bayes Classifier
- The assumptionof all variables being independent that the Naive Bayes classifier makes very rarely holds true in the real world.
Despite adopting extremely over-simplified assumptions of the data, the Naive Bayes classifier has still proven itself to be a very effective classifier in many real world applications. Machine learning has been responsible for major impact in all sectors that have integrated it into part of it’s workflow. Many more businesses in various industries are beginning to invest in Artificial Intelligence & Machine learning as it’s believed this phenomena would be vital for long-term success in business.
Here at Datatron, we offer a platform to govern and manage all of your Machine Learning, Artificial Intelligence, and Data Science Models in Production. Additionally, we help you automate, optimize, and accelerate your Machine Learning models to ensure they are running smoothly and efficiently in production — To learn more about our services be sure to Request a Demo.