Objective: Apply Naïve Baye’s Classsification Model.
Theory: Naïve Bayes algorithm is a supervised learning algorithm, which is based
on Bayes theorem and used for solving classification problems. It is mainly used in text
classification that includes a high-dimensional training dataset. Naïve Bayes Classifier is one of
the simple and most effective Classification algorithms which helps in building the fast machine
learning models that can make quick predictions. It is a probabilistic classifier, which means it
predicts on the basis of the probability of an object. Some popular examples of Naïve Bayes
Algorithm are spam filtration, Sentimental analysis, and classifying articles
Working of Naïve Bayes' Classifier can be understood with the help of the below example:
Suppose we have a dataset of weather conditions and corresponding target variable "Play". So
using this dataset we need to decide that whether we should play or not on a particular day
according to the weather conditions. So to solve this problem, we need to follow the below
steps:
1.Convert the given dataset into frequency tables.
2.Generate Likelihood table by finding the probabilities of given features.
Now, use Bayes theorem to calculate the posterior probability.
Code in Python:
Result: This model is giving an accuracy of 90% .
------------------------------x--------------------------------------------x---------------