SlideShare a Scribd company logo
NAIVE BAYES
Table of contents
01
02
03
04
About Naive
Bayes
Pros of
Naive Bayes
Bayes
Theorem
Types of Naive
Bayes
Cons of
Naive Bayes
05
Understanding
Naive Bayes
06
When to use
Naive Bayes
Application of
Naive Bayes
07
08
What Is Naive Bayes?
● Naive Bayes is a supervised learning algorithm,
based on Bayes theorem and used to solve
classification problems.
● It can be easily written in code and predictions can
be made real quick, which in turn increases the
scalability of the solution.
● It is a probabilistic classifier, which means it
predicts on the basis of the probability of an object.
What Is Naive Bayes?(Cont.)
● 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.
● Some popular examples of Naive Bayes
Algorithm are spam filtration, Sentimental
analysis, and classifying articles.
Why is it called Naive Bayes?
Naive Bayes algorithm is comprised of two words Naive and Bayes, which can be
Summarized as:
Naive — It is called Naive because it assumes that the occurrence of a certain
feature is independent of the occurrence of other features. Which might not be
true in real life.
Example: If a strawberry is ripe or not to harvest?
Assume, two independent features in this case: Size and Color. To demonstrate
the assumptions are partially invalid, pose the following two critical questions:
Why is it called Naive Bayes?(Cont.)
● Size and Color are independent? Not really, a positive
correlation could be seen apparently. The fruit grows,
expanding in size and changing in color.
● Size and Color equally contribute to the outcome of
“Being ripe”? Not really! Although it greatly depends on
the type of fruit, we can roughly anticipate the answer.
Bayes — It is called Bayes because it depends on the principle of Bayes'
Theorem.
How do Naive Bayes Algorithm work?
● Convert the data set into a frequency table.
● Create Likelihood table by finding the probabilities.
● Use Naive Bayesian equation to calculate the posterior probability.
Types of Naive Bayes Classifier
● Gaussian Naive Bayes — In a Gaussian Naive Bayes, the predictors take a continuous
value assuming that it has been sampled from a Gaussian Distribution. It is also called
a Normal Distribution.
● Multinomial Naive Bayes — These types of classifiers are usually used for the
problems of document classification. It checks whether the document belongs to a
particular category like sports or technology or political etc and then classifies them
accordingly. The predictors used for classification in this technique are the frequency
of words present in the document.
● Bernoulli Naive Bayes — This classifier is also analogous to multinomial naive bayes
but instead of words, the predictors are Boolean values. The parameters used to
predict the class variable accepts only yes or no values, for example, if a word occurs
in the text or not.
Pros & Cons of Naive Bayes
Pros of Naive Bayes —
● It is easy and fast to predict the class of the training data set.
● It performs well in multiclass prediction.
● It performs better as compared to other models like logistic regression while
assuming the independent variables.
● It requires less training data.
● It performs better in the case of categorical input variables as compared to
numerical variables.
Pros & Cons of Naive Bayes(Cont.)
Cons of Naive Bayes-
● The model will assign a 0 (zero) probability and will be unable to make a
prediction if categorical variable has a category (in test data set). This is
often known as “Zero Frequency”. To solve this, we can use the smoothing
technique like ”Laplace estimation”.
● Another limitation of this algorithm is the assumption of independent
predictors. In real life, it is almost impossible that we get a set of predictors
which are completely independent.
● Naive Bayes is also known as a bad estimator, so the probability outputs are
not taken seriously.
Bayes Theorem
Bayes' theorem helps you examine the probability of an event based on the prior knowledge of
any event that has correspondence to the former event. Its uses are mainly found in probability
theory and statistics. The formula for Bayes' theorem is given as:
Where, A and B are called events.
● P(A | B) is the probability of event A, given the event B is true (has occurred). Event B
is also termed as evidence.
● P(A) is the priori of A (the prior independent probability, i.e. probability of event before
evidence is seen).
● P(B) is the priori of B(the prior independent probability, i.e. probability of event before
evidence is seen).
● P(B | A) is the probability of B given event A, i.e. probability of event B after evidence
A is seen.
Understanding Naive Bayes
Shopping Example
Based on this dataset containing three types of input Day, Discount and Free Delivery. We
will populate frequency tables for each attribute.
Understanding Naive Bayes
Shopping Example
For our Bayes Theorem, Let the event Buy be A and the independent variable
Discount, Free Delivery and Day be B. Let’s look into the representation of the events
in the below figure.
Understanding Naive Bayes
Shopping Example
Likelihood Table for the variable
Day, Discount and Free Delivery
with probabilities:
Understanding Naive Bayes
Shopping Example
Based on the table Day conditional probabilities are given below,
P(B) = P(Weekday) = 11/30 = 0.367
P(A) = P(Buy) = 24/30 = 0.8, P(A) = P(No Buy) = 6/30 = 0.2
P(B|A)= P(Weekday|Buy) = 9/24 = 0.375, P(B|A) = P(Weekday|No Buy) = 2/6 = 0.33
If A equals Buy then:
P(A|B) = P(Buy|Weekday) =P(Weekday|Buy)*P(Buy)/P(Weekday)
=(0.375*0.8)/0.367 = 0.817
Again,
If A equals No Buy then:
P(A|B) = P(No Buy|Weekday) =P(Weekday|No Buy)*P(No Buy)/P(Weekday)
=(0.33*0.2)/0.367 = 0.179
As the Probability(Buy|Weekday) is more than the Probability(No Buy|Weekday) , we can
conclude that a customer will most likely buy the product on a Weekday.
Understanding Naive Bayes
Shopping Example
Now we will use the three likelihood tables to calculate whether a customer will purchase a
product on a specific combination of Day=Holiday with Free Delivery and Discount.
Understanding Naive Bayes
Shopping Example
Probability of purchase = 0.986
Probability of no purchase = 0.178
Now normalizing these conditional probabilities to get the likelihood of this events.
Sum of the probabilities = 0.986 + 0.178 = 1.164
Likelihood of purchase = 0.986/1.164 = 84.71%
Likelihood of no purchase = 0.178/1.164 = 15.29%
As 84.71% is greater than 15.29%, we can conclude that an average customer will
buy on a Holiday with Discount and Free Delivery.
When to use Naive Bayes
A Naive Bayesian classifier performs worse than a complex classifier due to the strict
assumptions it makes about the data. The classifier, however, has some patterns:
● Training and predicting the model is done at a high speed.
● Probabilistic predictions can be created purely based on the data.
● They are usually pretty easy to interpret.
● Their parameters are usually not tunable.
Application of Naive Bayes Classifier
Application of Naive Bayes Classifier
In the field of machine learning, Naive Bayes is used as a classification model, i.e. to classify a
data set into a certain class. There are various concrete applications for these models for which
Naive Bayes is also used:
● Real-time prediction.
● Multi-class prediction.
● Recommendation Systems.
● Classification of credit risk.
● Face Recognition.
● Predict Medical treatment.
● Text Classification/ Spam Filtering / Sentiment Analysis :
They are mostly used in text classification problems because of its multi-class
problems and the independence rule. They are used for identifying spam
emails and also to identify negative and positive customer sentiments on
social platforms.
Application of Naive Bayes Classifier
Spam Classification
1.Diagram for classifying Spam text data.
Application of Naive Bayes Classifier
Spam Classification
2. Training set with instances, if the comments are spam or not. These will be used for
the new comment.
Application of Naive Bayes Classifier
Spam Classification
3.Feature extraction
Application of Naive Bayes Classifier
Spam Classification
4.Finding if the text will be Spam or Ham.
Application of Naive Bayes Classifier
Spam Classification
4.Finding if the text will be Spam or Ham (cont.).
Application of Naive Bayes Classifier
Spam Classification
5. Comparing the values, we found that the text “I love song” is not spam or ham
as we got greater value after calculation.
CREDITS: This presentation template was
created by Slidesgo, and includes icons by
Flaticon and infographics & images by Freepik
Thank
you!_
● How to Use Naive Bayes for Text Classification in Python? (turing.com)
● Naive Bayes in Machine Learning [Examples, Models, Types] (knowledgehut.com)
● Naive Bayes Classifier | Simplilearn
● What is the Naive Bayes Algorithm? | Data Basecamp
● Introducing Naive Bayes Classifier | by Reshma R | Medium
● Naive Bayes in Machine Learning [Examples, Models, Types] (knowledgehut.com)
● https://youtu.be/GBMMtXRiQX0?si=-wHW3LDWIlhenSbV
● Why Naive Bayes is called “naive”? and what are the benefits of being “naive”?
● Naïve Bayes Algorithm: Everything You Need to Know - KDnuggets
● https://youtu.be/p-nuCQ_VmN4?si=bYpKFGmB2IoWYNr8
● https://youtu.be/O2L2Uv9pdDA?si=3SUv2xe0v1yrwLYf
Reference_

More Related Content

What's hot

Naive Bayes Classifier
Naive Bayes ClassifierNaive Bayes Classifier
Naive Bayes Classifier
Yiqun Hu
 
Introduction to Maximum Likelihood Estimator
Introduction to Maximum Likelihood EstimatorIntroduction to Maximum Likelihood Estimator
Introduction to Maximum Likelihood Estimator
Amir Al-Ansary
 
Ensemble methods
Ensemble methods Ensemble methods
Ensemble methods
zekeLabs Technologies
 
Decision trees in Machine Learning
Decision trees in Machine Learning Decision trees in Machine Learning
Decision trees in Machine Learning
Mohammad Junaid Khan
 
Decision tree
Decision treeDecision tree
Decision tree
SEMINARGROOT
 
. An introduction to machine learning and probabilistic ...
. An introduction to machine learning and probabilistic .... An introduction to machine learning and probabilistic ...
. An introduction to machine learning and probabilistic ...butest
 
Logistic Regression.pptx
Logistic Regression.pptxLogistic Regression.pptx
Logistic Regression.pptx
Muskaan194530
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
Rishabh Gupta
 
Naive Bayes
Naive BayesNaive Bayes
Naive Bayes
CloudxLab
 
Supervised and Unsupervised Machine Learning
Supervised and Unsupervised Machine LearningSupervised and Unsupervised Machine Learning
Supervised and Unsupervised Machine Learning
Spotle.ai
 
ML - Multiple Linear Regression
ML - Multiple Linear RegressionML - Multiple Linear Regression
ML - Multiple Linear Regression
Andrew Ferlitsch
 
Introduction to machine learning
Introduction to machine learningIntroduction to machine learning
Introduction to machine learning
Koundinya Desiraju
 
Decision Tree Learning
Decision Tree LearningDecision Tree Learning
Decision Tree Learning
Milind Gokhale
 
An overview of gradient descent optimization algorithms
An overview of gradient descent optimization algorithms An overview of gradient descent optimization algorithms
An overview of gradient descent optimization algorithms
Hakky St
 
CART – Classification & Regression Trees
CART – Classification & Regression TreesCART – Classification & Regression Trees
CART – Classification & Regression Trees
Hemant Chetwani
 
Introduction to Principle Component Analysis
Introduction to Principle Component AnalysisIntroduction to Principle Component Analysis
Introduction to Principle Component Analysis
Sunjeet Jena
 
multiple linear regression
multiple linear regressionmultiple linear regression
multiple linear regression
Akhilesh Joshi
 
Decision tree
Decision treeDecision tree
Decision tree
Ami_Surati
 
Intro to Feature Selection
Intro to Feature SelectionIntro to Feature Selection
Intro to Feature Selectionchenhm
 
Exploratory data analysis with Python
Exploratory data analysis with PythonExploratory data analysis with Python
Exploratory data analysis with Python
Davis David
 

What's hot (20)

Naive Bayes Classifier
Naive Bayes ClassifierNaive Bayes Classifier
Naive Bayes Classifier
 
Introduction to Maximum Likelihood Estimator
Introduction to Maximum Likelihood EstimatorIntroduction to Maximum Likelihood Estimator
Introduction to Maximum Likelihood Estimator
 
Ensemble methods
Ensemble methods Ensemble methods
Ensemble methods
 
Decision trees in Machine Learning
Decision trees in Machine Learning Decision trees in Machine Learning
Decision trees in Machine Learning
 
Decision tree
Decision treeDecision tree
Decision tree
 
. An introduction to machine learning and probabilistic ...
. An introduction to machine learning and probabilistic .... An introduction to machine learning and probabilistic ...
. An introduction to machine learning and probabilistic ...
 
Logistic Regression.pptx
Logistic Regression.pptxLogistic Regression.pptx
Logistic Regression.pptx
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
 
Naive Bayes
Naive BayesNaive Bayes
Naive Bayes
 
Supervised and Unsupervised Machine Learning
Supervised and Unsupervised Machine LearningSupervised and Unsupervised Machine Learning
Supervised and Unsupervised Machine Learning
 
ML - Multiple Linear Regression
ML - Multiple Linear RegressionML - Multiple Linear Regression
ML - Multiple Linear Regression
 
Introduction to machine learning
Introduction to machine learningIntroduction to machine learning
Introduction to machine learning
 
Decision Tree Learning
Decision Tree LearningDecision Tree Learning
Decision Tree Learning
 
An overview of gradient descent optimization algorithms
An overview of gradient descent optimization algorithms An overview of gradient descent optimization algorithms
An overview of gradient descent optimization algorithms
 
CART – Classification & Regression Trees
CART – Classification & Regression TreesCART – Classification & Regression Trees
CART – Classification & Regression Trees
 
Introduction to Principle Component Analysis
Introduction to Principle Component AnalysisIntroduction to Principle Component Analysis
Introduction to Principle Component Analysis
 
multiple linear regression
multiple linear regressionmultiple linear regression
multiple linear regression
 
Decision tree
Decision treeDecision tree
Decision tree
 
Intro to Feature Selection
Intro to Feature SelectionIntro to Feature Selection
Intro to Feature Selection
 
Exploratory data analysis with Python
Exploratory data analysis with PythonExploratory data analysis with Python
Exploratory data analysis with Python
 

Similar to Naive Bayes

Naïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptxNaïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptx
Shubham Jaybhaye
 
NAIVE BAYES ALGORITHM
NAIVE BAYES ALGORITHMNAIVE BAYES ALGORITHM
NAIVE BAYES ALGORITHM
Rang Technologies
 
Naïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptxNaïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptx
PriyadharshiniG41
 
UNIT2_NaiveBayes algorithms used in machine learning
UNIT2_NaiveBayes algorithms used in machine learningUNIT2_NaiveBayes algorithms used in machine learning
UNIT2_NaiveBayes algorithms used in machine learning
michaelaaron25322
 
Ml part2
Ml part2Ml part2
Ml part2
Leon Gladston
 
Prediciting restaurant and popularity based on Yelp Dataset project report
Prediciting restaurant and popularity based on Yelp Dataset  project reportPrediciting restaurant and popularity based on Yelp Dataset  project report
Prediciting restaurant and popularity based on Yelp Dataset project report
ALIN BABU
 
Machine learning naive bayes and svm.pdf
Machine learning naive bayes and svm.pdfMachine learning naive bayes and svm.pdf
Machine learning naive bayes and svm.pdf
SubhamKumar3239
 
Navies bayes
Navies bayesNavies bayes
Navies bayes
HassanRaza323
 
Naive Bayes classifier ( Ai Ml 182118).pptx
Naive Bayes classifier ( Ai Ml 182118).pptxNaive Bayes classifier ( Ai Ml 182118).pptx
Naive Bayes classifier ( Ai Ml 182118).pptx
taherzamanrather
 
CS3501.pptx
CS3501.pptxCS3501.pptx
CS3501.pptx
Waseelsultan
 
Naive.pdf
Naive.pdfNaive.pdf
Naive.pdf
MahimMajee
 
classification_clean.pdf
classification_clean.pdfclassification_clean.pdf
classification_clean.pdf
Afaq Ahmad
 
Naive Bayes | Statistics
Naive Bayes | StatisticsNaive Bayes | Statistics
Naive Bayes | Statistics
Transweb Global Inc
 
Naive_hehe.pptx
Naive_hehe.pptxNaive_hehe.pptx
Naive_hehe.pptx
MahimMajee
 
Machine learning(UNIT 4)
Machine learning(UNIT 4)Machine learning(UNIT 4)
Machine learning(UNIT 4)
SURBHI SAROHA
 
Driver Analysis and Product Optimization with Bayesian Networks
Driver Analysis and Product Optimization with Bayesian NetworksDriver Analysis and Product Optimization with Bayesian Networks
Driver Analysis and Product Optimization with Bayesian Networks
Bayesia USA
 
Naive Bayes.pptx
Naive Bayes.pptxNaive Bayes.pptx
Naive Bayes.pptx
Uttara University
 
Supervised models
Supervised modelsSupervised models
Supervised models
Hasan Badran
 
Subscription fraud analytics using classification
Subscription fraud analytics using classificationSubscription fraud analytics using classification
Subscription fraud analytics using classification
Somdeep Sen
 
regression.pptx
regression.pptxregression.pptx
regression.pptx
aneeshs28
 

Similar to Naive Bayes (20)

Naïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptxNaïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptx
 
NAIVE BAYES ALGORITHM
NAIVE BAYES ALGORITHMNAIVE BAYES ALGORITHM
NAIVE BAYES ALGORITHM
 
Naïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptxNaïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptx
 
UNIT2_NaiveBayes algorithms used in machine learning
UNIT2_NaiveBayes algorithms used in machine learningUNIT2_NaiveBayes algorithms used in machine learning
UNIT2_NaiveBayes algorithms used in machine learning
 
Ml part2
Ml part2Ml part2
Ml part2
 
Prediciting restaurant and popularity based on Yelp Dataset project report
Prediciting restaurant and popularity based on Yelp Dataset  project reportPrediciting restaurant and popularity based on Yelp Dataset  project report
Prediciting restaurant and popularity based on Yelp Dataset project report
 
Machine learning naive bayes and svm.pdf
Machine learning naive bayes and svm.pdfMachine learning naive bayes and svm.pdf
Machine learning naive bayes and svm.pdf
 
Navies bayes
Navies bayesNavies bayes
Navies bayes
 
Naive Bayes classifier ( Ai Ml 182118).pptx
Naive Bayes classifier ( Ai Ml 182118).pptxNaive Bayes classifier ( Ai Ml 182118).pptx
Naive Bayes classifier ( Ai Ml 182118).pptx
 
CS3501.pptx
CS3501.pptxCS3501.pptx
CS3501.pptx
 
Naive.pdf
Naive.pdfNaive.pdf
Naive.pdf
 
classification_clean.pdf
classification_clean.pdfclassification_clean.pdf
classification_clean.pdf
 
Naive Bayes | Statistics
Naive Bayes | StatisticsNaive Bayes | Statistics
Naive Bayes | Statistics
 
Naive_hehe.pptx
Naive_hehe.pptxNaive_hehe.pptx
Naive_hehe.pptx
 
Machine learning(UNIT 4)
Machine learning(UNIT 4)Machine learning(UNIT 4)
Machine learning(UNIT 4)
 
Driver Analysis and Product Optimization with Bayesian Networks
Driver Analysis and Product Optimization with Bayesian NetworksDriver Analysis and Product Optimization with Bayesian Networks
Driver Analysis and Product Optimization with Bayesian Networks
 
Naive Bayes.pptx
Naive Bayes.pptxNaive Bayes.pptx
Naive Bayes.pptx
 
Supervised models
Supervised modelsSupervised models
Supervised models
 
Subscription fraud analytics using classification
Subscription fraud analytics using classificationSubscription fraud analytics using classification
Subscription fraud analytics using classification
 
regression.pptx
regression.pptxregression.pptx
regression.pptx
 

More from Abdullah al Mamun

Underfitting and Overfitting in Machine Learning
Underfitting and Overfitting in Machine LearningUnderfitting and Overfitting in Machine Learning
Underfitting and Overfitting in Machine Learning
Abdullah al Mamun
 
Recurrent Neural Networks (RNNs)
Recurrent Neural Networks (RNNs)Recurrent Neural Networks (RNNs)
Recurrent Neural Networks (RNNs)
Abdullah al Mamun
 
Random Forest
Random ForestRandom Forest
Random Forest
Abdullah al Mamun
 
Principal Component Analysis PCA
Principal Component Analysis PCAPrincipal Component Analysis PCA
Principal Component Analysis PCA
Abdullah al Mamun
 
Natural Language Processing (NLP)
Natural Language Processing (NLP)Natural Language Processing (NLP)
Natural Language Processing (NLP)
Abdullah al Mamun
 
Multilayer Perceptron Neural Network MLP
Multilayer Perceptron Neural Network MLPMultilayer Perceptron Neural Network MLP
Multilayer Perceptron Neural Network MLP
Abdullah al Mamun
 
Long Short Term Memory LSTM
Long Short Term Memory LSTMLong Short Term Memory LSTM
Long Short Term Memory LSTM
Abdullah al Mamun
 
Linear Regression
Linear RegressionLinear Regression
Linear Regression
Abdullah al Mamun
 
K-Nearest Neighbor(KNN)
K-Nearest Neighbor(KNN)K-Nearest Neighbor(KNN)
K-Nearest Neighbor(KNN)
Abdullah al Mamun
 
Hidden Markov Model (HMM)
Hidden Markov Model (HMM)Hidden Markov Model (HMM)
Hidden Markov Model (HMM)
Abdullah al Mamun
 
Ensemble Method (Bagging Boosting)
Ensemble Method (Bagging Boosting)Ensemble Method (Bagging Boosting)
Ensemble Method (Bagging Boosting)
Abdullah al Mamun
 
Convolutional Neural Networks CNN
Convolutional Neural Networks CNNConvolutional Neural Networks CNN
Convolutional Neural Networks CNN
Abdullah al Mamun
 
Artificial Neural Network ANN
Artificial Neural Network ANNArtificial Neural Network ANN
Artificial Neural Network ANN
Abdullah al Mamun
 
Reinforcement Learning, Application and Q-Learning
Reinforcement Learning, Application and Q-LearningReinforcement Learning, Application and Q-Learning
Reinforcement Learning, Application and Q-Learning
Abdullah al Mamun
 
Session on evaluation of DevSecOps
Session on evaluation of DevSecOpsSession on evaluation of DevSecOps
Session on evaluation of DevSecOps
Abdullah al Mamun
 
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
Abdullah al Mamun
 
DevOps Presentation.pptx
DevOps Presentation.pptxDevOps Presentation.pptx
DevOps Presentation.pptx
Abdullah al Mamun
 
Python Virtual Environment.pptx
Python Virtual Environment.pptxPython Virtual Environment.pptx
Python Virtual Environment.pptx
Abdullah al Mamun
 
Artificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptxArtificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptx
Abdullah al Mamun
 
An approach to empirical Optical Character recognition paradigm using Multi-L...
An approach to empirical Optical Character recognition paradigm using Multi-L...An approach to empirical Optical Character recognition paradigm using Multi-L...
An approach to empirical Optical Character recognition paradigm using Multi-L...
Abdullah al Mamun
 

More from Abdullah al Mamun (20)

Underfitting and Overfitting in Machine Learning
Underfitting and Overfitting in Machine LearningUnderfitting and Overfitting in Machine Learning
Underfitting and Overfitting in Machine Learning
 
Recurrent Neural Networks (RNNs)
Recurrent Neural Networks (RNNs)Recurrent Neural Networks (RNNs)
Recurrent Neural Networks (RNNs)
 
Random Forest
Random ForestRandom Forest
Random Forest
 
Principal Component Analysis PCA
Principal Component Analysis PCAPrincipal Component Analysis PCA
Principal Component Analysis PCA
 
Natural Language Processing (NLP)
Natural Language Processing (NLP)Natural Language Processing (NLP)
Natural Language Processing (NLP)
 
Multilayer Perceptron Neural Network MLP
Multilayer Perceptron Neural Network MLPMultilayer Perceptron Neural Network MLP
Multilayer Perceptron Neural Network MLP
 
Long Short Term Memory LSTM
Long Short Term Memory LSTMLong Short Term Memory LSTM
Long Short Term Memory LSTM
 
Linear Regression
Linear RegressionLinear Regression
Linear Regression
 
K-Nearest Neighbor(KNN)
K-Nearest Neighbor(KNN)K-Nearest Neighbor(KNN)
K-Nearest Neighbor(KNN)
 
Hidden Markov Model (HMM)
Hidden Markov Model (HMM)Hidden Markov Model (HMM)
Hidden Markov Model (HMM)
 
Ensemble Method (Bagging Boosting)
Ensemble Method (Bagging Boosting)Ensemble Method (Bagging Boosting)
Ensemble Method (Bagging Boosting)
 
Convolutional Neural Networks CNN
Convolutional Neural Networks CNNConvolutional Neural Networks CNN
Convolutional Neural Networks CNN
 
Artificial Neural Network ANN
Artificial Neural Network ANNArtificial Neural Network ANN
Artificial Neural Network ANN
 
Reinforcement Learning, Application and Q-Learning
Reinforcement Learning, Application and Q-LearningReinforcement Learning, Application and Q-Learning
Reinforcement Learning, Application and Q-Learning
 
Session on evaluation of DevSecOps
Session on evaluation of DevSecOpsSession on evaluation of DevSecOps
Session on evaluation of DevSecOps
 
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
 
DevOps Presentation.pptx
DevOps Presentation.pptxDevOps Presentation.pptx
DevOps Presentation.pptx
 
Python Virtual Environment.pptx
Python Virtual Environment.pptxPython Virtual Environment.pptx
Python Virtual Environment.pptx
 
Artificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptxArtificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptx
 
An approach to empirical Optical Character recognition paradigm using Multi-L...
An approach to empirical Optical Character recognition paradigm using Multi-L...An approach to empirical Optical Character recognition paradigm using Multi-L...
An approach to empirical Optical Character recognition paradigm using Multi-L...
 

Recently uploaded

Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
Oppotus
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Subhajit Sahu
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
axoqas
 
Adjusting OpenMP PageRank : SHORT REPORT / NOTES
Adjusting OpenMP PageRank : SHORT REPORT / NOTESAdjusting OpenMP PageRank : SHORT REPORT / NOTES
Adjusting OpenMP PageRank : SHORT REPORT / NOTES
Subhajit Sahu
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
ahzuo
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
g4dpvqap0
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
mbawufebxi
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
slg6lamcq
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
balafet
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
74nqk8xf
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
jerlynmaetalle
 
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptxData_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
AnirbanRoy608946
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
Roger Valdez
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 

Recently uploaded (20)

Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
 
Adjusting OpenMP PageRank : SHORT REPORT / NOTES
Adjusting OpenMP PageRank : SHORT REPORT / NOTESAdjusting OpenMP PageRank : SHORT REPORT / NOTES
Adjusting OpenMP PageRank : SHORT REPORT / NOTES
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
 
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptxData_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 

Naive Bayes

  • 2. Table of contents 01 02 03 04 About Naive Bayes Pros of Naive Bayes Bayes Theorem Types of Naive Bayes Cons of Naive Bayes 05 Understanding Naive Bayes 06 When to use Naive Bayes Application of Naive Bayes 07 08
  • 3. What Is Naive Bayes? ● Naive Bayes is a supervised learning algorithm, based on Bayes theorem and used to solve classification problems. ● It can be easily written in code and predictions can be made real quick, which in turn increases the scalability of the solution. ● It is a probabilistic classifier, which means it predicts on the basis of the probability of an object.
  • 4. What Is Naive Bayes?(Cont.) ● 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. ● Some popular examples of Naive Bayes Algorithm are spam filtration, Sentimental analysis, and classifying articles.
  • 5. Why is it called Naive Bayes? Naive Bayes algorithm is comprised of two words Naive and Bayes, which can be Summarized as: Naive — It is called Naive because it assumes that the occurrence of a certain feature is independent of the occurrence of other features. Which might not be true in real life. Example: If a strawberry is ripe or not to harvest? Assume, two independent features in this case: Size and Color. To demonstrate the assumptions are partially invalid, pose the following two critical questions:
  • 6. Why is it called Naive Bayes?(Cont.) ● Size and Color are independent? Not really, a positive correlation could be seen apparently. The fruit grows, expanding in size and changing in color. ● Size and Color equally contribute to the outcome of “Being ripe”? Not really! Although it greatly depends on the type of fruit, we can roughly anticipate the answer. Bayes — It is called Bayes because it depends on the principle of Bayes' Theorem.
  • 7. How do Naive Bayes Algorithm work? ● Convert the data set into a frequency table. ● Create Likelihood table by finding the probabilities. ● Use Naive Bayesian equation to calculate the posterior probability.
  • 8. Types of Naive Bayes Classifier ● Gaussian Naive Bayes — In a Gaussian Naive Bayes, the predictors take a continuous value assuming that it has been sampled from a Gaussian Distribution. It is also called a Normal Distribution. ● Multinomial Naive Bayes — These types of classifiers are usually used for the problems of document classification. It checks whether the document belongs to a particular category like sports or technology or political etc and then classifies them accordingly. The predictors used for classification in this technique are the frequency of words present in the document. ● Bernoulli Naive Bayes — This classifier is also analogous to multinomial naive bayes but instead of words, the predictors are Boolean values. The parameters used to predict the class variable accepts only yes or no values, for example, if a word occurs in the text or not.
  • 9. Pros & Cons of Naive Bayes Pros of Naive Bayes — ● It is easy and fast to predict the class of the training data set. ● It performs well in multiclass prediction. ● It performs better as compared to other models like logistic regression while assuming the independent variables. ● It requires less training data. ● It performs better in the case of categorical input variables as compared to numerical variables.
  • 10. Pros & Cons of Naive Bayes(Cont.) Cons of Naive Bayes- ● The model will assign a 0 (zero) probability and will be unable to make a prediction if categorical variable has a category (in test data set). This is often known as “Zero Frequency”. To solve this, we can use the smoothing technique like ”Laplace estimation”. ● Another limitation of this algorithm is the assumption of independent predictors. In real life, it is almost impossible that we get a set of predictors which are completely independent. ● Naive Bayes is also known as a bad estimator, so the probability outputs are not taken seriously.
  • 11. Bayes Theorem Bayes' theorem helps you examine the probability of an event based on the prior knowledge of any event that has correspondence to the former event. Its uses are mainly found in probability theory and statistics. The formula for Bayes' theorem is given as: Where, A and B are called events. ● P(A | B) is the probability of event A, given the event B is true (has occurred). Event B is also termed as evidence. ● P(A) is the priori of A (the prior independent probability, i.e. probability of event before evidence is seen). ● P(B) is the priori of B(the prior independent probability, i.e. probability of event before evidence is seen). ● P(B | A) is the probability of B given event A, i.e. probability of event B after evidence A is seen.
  • 12. Understanding Naive Bayes Shopping Example Based on this dataset containing three types of input Day, Discount and Free Delivery. We will populate frequency tables for each attribute.
  • 13. Understanding Naive Bayes Shopping Example For our Bayes Theorem, Let the event Buy be A and the independent variable Discount, Free Delivery and Day be B. Let’s look into the representation of the events in the below figure.
  • 14. Understanding Naive Bayes Shopping Example Likelihood Table for the variable Day, Discount and Free Delivery with probabilities:
  • 15. Understanding Naive Bayes Shopping Example Based on the table Day conditional probabilities are given below, P(B) = P(Weekday) = 11/30 = 0.367 P(A) = P(Buy) = 24/30 = 0.8, P(A) = P(No Buy) = 6/30 = 0.2 P(B|A)= P(Weekday|Buy) = 9/24 = 0.375, P(B|A) = P(Weekday|No Buy) = 2/6 = 0.33 If A equals Buy then: P(A|B) = P(Buy|Weekday) =P(Weekday|Buy)*P(Buy)/P(Weekday) =(0.375*0.8)/0.367 = 0.817 Again, If A equals No Buy then: P(A|B) = P(No Buy|Weekday) =P(Weekday|No Buy)*P(No Buy)/P(Weekday) =(0.33*0.2)/0.367 = 0.179 As the Probability(Buy|Weekday) is more than the Probability(No Buy|Weekday) , we can conclude that a customer will most likely buy the product on a Weekday.
  • 16. Understanding Naive Bayes Shopping Example Now we will use the three likelihood tables to calculate whether a customer will purchase a product on a specific combination of Day=Holiday with Free Delivery and Discount.
  • 17. Understanding Naive Bayes Shopping Example Probability of purchase = 0.986 Probability of no purchase = 0.178 Now normalizing these conditional probabilities to get the likelihood of this events. Sum of the probabilities = 0.986 + 0.178 = 1.164 Likelihood of purchase = 0.986/1.164 = 84.71% Likelihood of no purchase = 0.178/1.164 = 15.29% As 84.71% is greater than 15.29%, we can conclude that an average customer will buy on a Holiday with Discount and Free Delivery.
  • 18. When to use Naive Bayes A Naive Bayesian classifier performs worse than a complex classifier due to the strict assumptions it makes about the data. The classifier, however, has some patterns: ● Training and predicting the model is done at a high speed. ● Probabilistic predictions can be created purely based on the data. ● They are usually pretty easy to interpret. ● Their parameters are usually not tunable.
  • 19. Application of Naive Bayes Classifier
  • 20. Application of Naive Bayes Classifier In the field of machine learning, Naive Bayes is used as a classification model, i.e. to classify a data set into a certain class. There are various concrete applications for these models for which Naive Bayes is also used: ● Real-time prediction. ● Multi-class prediction. ● Recommendation Systems. ● Classification of credit risk. ● Face Recognition. ● Predict Medical treatment. ● Text Classification/ Spam Filtering / Sentiment Analysis : They are mostly used in text classification problems because of its multi-class problems and the independence rule. They are used for identifying spam emails and also to identify negative and positive customer sentiments on social platforms.
  • 21. Application of Naive Bayes Classifier Spam Classification 1.Diagram for classifying Spam text data.
  • 22. Application of Naive Bayes Classifier Spam Classification 2. Training set with instances, if the comments are spam or not. These will be used for the new comment.
  • 23. Application of Naive Bayes Classifier Spam Classification 3.Feature extraction
  • 24. Application of Naive Bayes Classifier Spam Classification 4.Finding if the text will be Spam or Ham.
  • 25. Application of Naive Bayes Classifier Spam Classification 4.Finding if the text will be Spam or Ham (cont.).
  • 26. Application of Naive Bayes Classifier Spam Classification 5. Comparing the values, we found that the text “I love song” is not spam or ham as we got greater value after calculation.
  • 27. CREDITS: This presentation template was created by Slidesgo, and includes icons by Flaticon and infographics & images by Freepik Thank you!_
  • 28. ● How to Use Naive Bayes for Text Classification in Python? (turing.com) ● Naive Bayes in Machine Learning [Examples, Models, Types] (knowledgehut.com) ● Naive Bayes Classifier | Simplilearn ● What is the Naive Bayes Algorithm? | Data Basecamp ● Introducing Naive Bayes Classifier | by Reshma R | Medium ● Naive Bayes in Machine Learning [Examples, Models, Types] (knowledgehut.com) ● https://youtu.be/GBMMtXRiQX0?si=-wHW3LDWIlhenSbV ● Why Naive Bayes is called “naive”? and what are the benefits of being “naive”? ● Naïve Bayes Algorithm: Everything You Need to Know - KDnuggets ● https://youtu.be/p-nuCQ_VmN4?si=bYpKFGmB2IoWYNr8 ● https://youtu.be/O2L2Uv9pdDA?si=3SUv2xe0v1yrwLYf Reference_