Naïve baye’s
classification
Group no 2:
Ramsha Hanif (049)
Ali Usama (021)
Urwa shehzadi (041)
Ali Ahmed (058)
Agenda
• Naïve Bayes Classifier Algorithm introduction
• Why is it called Naïve Bayes?
• Bayes' Theorem:
• Working of Naïve Bayes' Classifier:
• Problem
• Advantages & Disadvantages of Naïve Bayes Classifier
• Applications of Naïve Bayes Classifier
• Types of Naïve Bayes Model
12/15/2022 PRESENTATION TITLE 2
Introduction
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. 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.
12/15/2022 Naïve baye’s classifer 3
Why is it called Naïve
Bayes?
The Naïve Bayes algorithm is comprised of two words Naïve
and Bayes, Which can be described as:
•Naïve: It is called Naïve because it assumes that the occurrence
of a certain feature is independent of the occurrence of other
features.
•Bayes: It is called Bayes because it depends on the principle of
Bayes' Theorem.
Bayes' Theorem:
•Bayes' theorem is also known as Bayes' Rule or Bayes' law, which is used to
determine the probability of a hypothesis with prior knowledge. It depends on
the conditional probability.
•The formula for Bayes' theorem is given as:
12/15/2022 PRESENTATION TITLE 5
Working of Naïve Bayes' Classifier:
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:
[Link] the given dataset into frequency tables.
[Link] Likelihood table by finding the probabilities of given features.
[Link], use Bayes theorem to calculate the posterior probability.
12/15/2022 PRESENTATION TITLE 6
“ Problem
If the weather is sunny, then the
”
Player should play or not?
Richard Branson
12/15/2022 PRESENTATION TITLE 7
Solution:
To solve this, first consider the below dataset:
12/15/2022 PRESENTATION TITLE 8
Frequency table for the Weather Conditions
12/15/2022 PRESENTATION TITLE 9
Likelihood Table Weather Conditions:
12/15/2022 PRESENTATION TITLE 10
Applying Bayes 'theorem:
P(Yes|Sunny)= P(Sunny|Yes)*P(Yes)/P(Sunny)
P(Sunny|Yes)= 3/10= 0.3
P(Sunny)= 0.35
P(Yes)=0.71
So P(Yes|Sunny) = 0.3*0.71/0.35= 0.60
P(No|Sunny)= P(Sunny|No)*P(No)/P(Sunny)
P(Sunny|NO)= 2/4=0.5
P(No)= 0.29
P(Sunny)= 0.35
So P(No|Sunny)= 0.5*0.29/0.35 = 0.41
So as we can see from the above calculation that P(Yes|Sunny)>P(No|Sunny)
Hence on a Sunny day, Player can play the game.
12/15/2022 PRESENTATION TITLE 11
Advantages of Naïve Bayes Classifier:
Naïve Bayes is one of the fast and easy ML algorithms to predict a
class of datasets.
It can be used for Binary as well as Multi-class Classifications.
It performs well in Multi-class predictions as compared to the other
Algorithms.
It is the most popular choice for text classification problems
12/15/2022 PRESENTATION TITLE 12
Disadvantages of Naïve Bayes
Classifier
Naive Bayes assumes that all features are independent or
unrelated, so it cannot learn the relationship between features.
12/15/2022 PRESENTATION TITLE 13
Types of Naïve Bayes Model:
1 2 3
Multinomia
Gaussian Bernoulli
l
12/15/2022 PRESENTATION TITLE 14
Applications of Naïve Bayes Classifier:
•It is used for Credit Scoring.
•It is used in medical data classification.
•It can be used in real-time predictions because Naïve Bayes Classifier is an eager learner.
•It is used in Text classification such as Spam filtering and Sentiment analysis.
12/15/2022 PRESENTATION TITLE 15
Thank you