0% found this document useful (0 votes)
6 views5 pages

Naive Bayes Classification_04c360b1c962b080d8b84f51f8a494ad

The Naive Bayes algorithm is a supervised learning method based on Bayes' theorem, primarily used for text classification and effective in handling high-dimensional datasets. It operates as a probabilistic classifier, making predictions based on the likelihood of events, with applications in spam filtration and sentiment analysis. The document also illustrates the working of the Naive Bayes classifier through an example involving weather conditions to determine if a player should play or not.

Uploaded by

begarinagaiah59
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Naive Bayes Classification_04c360b1c962b080d8b84f51f8a494ad

The Naive Bayes algorithm is a supervised learning method based on Bayes' theorem, primarily used for text classification and effective in handling high-dimensional datasets. It operates as a probabilistic classifier, making predictions based on the likelihood of events, with applications in spam filtration and sentiment analysis. The document also illustrates the working of the Naive Bayes classifier through an example involving weather conditions to determine if a player should play or not.

Uploaded by

begarinagaiah59
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Naive Bayes Classification

o Naive Bayes algorithm is a supervised learning algorithm, which is


based on Bayes theorem and used for solving classification
problems.
o It is mainly used in text classification that includes a high-
dimensional training dataset.
o Naive 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.
o It is a probabilistic classifier, which means it predicts on the
basis of the probability of an object.
o Some popular examples of Naïve Bayes Algorithm are spam
filtration, Sentimental analysis, and classifying articles.

Bayes' Theorem:
o 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.
o The formula for Bayes' theorem is given as:

Where,

P(A|B) is Posterior probability: Probability of hypothesis A on the


observed event B.

P(B|A) is Likelihood probability: The probability of the evidence given


that the probability of a hypothesis is true.

P(A) is Prior Probability: Probability of hypothesis before observing the


evidence.

P(B) is Marginal Probability: Probability of Evidence.


Working of Naive Bayes' Classifier:
1. Convert the given dataset into frequency tables.
2. Generate Likelihood table by finding the probabilities of given
features.
3. Now, use Bayes theorem to calculate the posterior probability.

Problem: If the weather is sunny, then the Player should play or not?

Solution: To solve this, first consider the below dataset:

Outlook Play

0 Rainy Yes

1 Sunny Yes

2 Overcast Yes

3 Overcast Yes

4 Sunny No

5 Rainy Yes

6 Sunny Yes

7 Overcast Yes

8 Rainy No

9 Sunny No

10 Sunny Yes

11 Rainy No

12 Overcast Yes

13 Overcast Yes
Frequency table for the Weather Conditions:

Weather Yes No

Overcast 5 0

Rainy 2 2

Sunny 3 2

Total 10 5

Likelihood table weather condition:

Weather No Yes

Overcast 0 5 5/14=
0.35

Rainy 2 2 4/14=0.2
9

Sunny 2 3 5/14=0.3
5

All 4/14=0. 10/14=0.


29 71

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.

You might also like