SlideShare a Scribd company logo
1 of 28
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

Artificial Neural Network Lect4 : Single Layer Perceptron Classifiers
Artificial Neural Network Lect4 : Single Layer Perceptron ClassifiersArtificial Neural Network Lect4 : Single Layer Perceptron Classifiers
Artificial Neural Network Lect4 : Single Layer Perceptron ClassifiersMohammed Bennamoun
 
Machine Learning and Robotics
Machine Learning and RoboticsMachine Learning and Robotics
Machine Learning and Roboticsbutest
 
Radial basis function network ppt bySheetal,Samreen and Dhanashri
Radial basis function network ppt bySheetal,Samreen and DhanashriRadial basis function network ppt bySheetal,Samreen and Dhanashri
Radial basis function network ppt bySheetal,Samreen and Dhanashrisheetal katkar
 
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hakky St
 
Feedforward neural network
Feedforward neural networkFeedforward neural network
Feedforward neural networkSopheaktra YONG
 
Machine Learning: Introduction to Neural Networks
Machine Learning: Introduction to Neural NetworksMachine Learning: Introduction to Neural Networks
Machine Learning: Introduction to Neural NetworksFrancesco Collova'
 
. 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
 
Types of machine learning
Types of machine learningTypes of machine learning
Types of machine learningHimaniAloona
 
Foundations of Machine Learning
Foundations of Machine LearningFoundations of Machine Learning
Foundations of Machine Learningmahutte
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent methodSanghyuk Chun
 
Machine learning session4(linear regression)
Machine learning   session4(linear regression)Machine learning   session4(linear regression)
Machine learning session4(linear regression)Abhimanyu Dwivedi
 
Machine learning
Machine learningMachine learning
Machine learningWes Eklund
 
What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?Kazuki Yoshida
 
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...Simplilearn
 
Convolutional Neural Networks
Convolutional Neural NetworksConvolutional Neural Networks
Convolutional Neural NetworksAshray Bhandare
 
Support Vector Machine ppt presentation
Support Vector Machine ppt presentationSupport Vector Machine ppt presentation
Support Vector Machine ppt presentationAyanaRukasar
 

What's hot (20)

Artificial Neural Network Lect4 : Single Layer Perceptron Classifiers
Artificial Neural Network Lect4 : Single Layer Perceptron ClassifiersArtificial Neural Network Lect4 : Single Layer Perceptron Classifiers
Artificial Neural Network Lect4 : Single Layer Perceptron Classifiers
 
Machine Learning and Robotics
Machine Learning and RoboticsMachine Learning and Robotics
Machine Learning and Robotics
 
Radial basis function network ppt bySheetal,Samreen and Dhanashri
Radial basis function network ppt bySheetal,Samreen and DhanashriRadial basis function network ppt bySheetal,Samreen and Dhanashri
Radial basis function network ppt bySheetal,Samreen and Dhanashri
 
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
 
Feedforward neural network
Feedforward neural networkFeedforward neural network
Feedforward neural network
 
Associative memory network
Associative memory networkAssociative memory network
Associative memory network
 
Perceptron in ANN
Perceptron in ANNPerceptron in ANN
Perceptron in ANN
 
Machine Learning: Introduction to Neural Networks
Machine Learning: Introduction to Neural NetworksMachine Learning: Introduction to Neural Networks
Machine Learning: Introduction to Neural Networks
 
07 approximate inference in bn
07 approximate inference in bn07 approximate inference in bn
07 approximate inference in bn
 
. 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 ...
 
Types of machine learning
Types of machine learningTypes of machine learning
Types of machine learning
 
Foundations of Machine Learning
Foundations of Machine LearningFoundations of Machine Learning
Foundations of Machine Learning
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent method
 
Machine learning session4(linear regression)
Machine learning   session4(linear regression)Machine learning   session4(linear regression)
Machine learning session4(linear regression)
 
Machine learning
Machine learningMachine learning
Machine learning
 
What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?
 
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
 
Convolutional Neural Networks
Convolutional Neural NetworksConvolutional Neural Networks
Convolutional Neural Networks
 
Support Vector Machine ppt presentation
Support Vector Machine ppt presentationSupport Vector Machine ppt presentation
Support Vector Machine ppt presentation
 
Machine learning
Machine learningMachine learning
Machine learning
 

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.pptxShubham Jaybhaye
 
Naïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptxNaïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptxPriyadharshiniG41
 
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 learningmichaelaaron25322
 
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 reportALIN 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.pdfSubhamKumar3239
 
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).pptxtaherzamanrather
 
classification_clean.pdf
classification_clean.pdfclassification_clean.pdf
classification_clean.pdfAfaq Ahmad
 
Naive_hehe.pptx
Naive_hehe.pptxNaive_hehe.pptx
Naive_hehe.pptxMahimMajee
 
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 NetworksBayesia USA
 
Subscription fraud analytics using classification
Subscription fraud analytics using classificationSubscription fraud analytics using classification
Subscription fraud analytics using classificationSomdeep Sen
 

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
Naive BayesNaive Bayes
Naive Bayes
 
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
 

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 LearningAbdullah al Mamun
 
Recurrent Neural Networks (RNNs)
Recurrent Neural Networks (RNNs)Recurrent Neural Networks (RNNs)
Recurrent Neural Networks (RNNs)Abdullah al Mamun
 
Principal Component Analysis PCA
Principal Component Analysis PCAPrincipal Component Analysis PCA
Principal Component Analysis PCAAbdullah 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 MLPAbdullah 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 CNNAbdullah al Mamun
 
Artificial Neural Network ANN
Artificial Neural Network ANNArtificial Neural Network ANN
Artificial Neural Network ANNAbdullah al Mamun
 
Reinforcement Learning, Application and Q-Learning
Reinforcement Learning, Application and Q-LearningReinforcement Learning, Application and Q-Learning
Reinforcement Learning, Application and Q-LearningAbdullah al Mamun
 
Session on evaluation of DevSecOps
Session on evaluation of DevSecOpsSession on evaluation of DevSecOps
Session on evaluation of DevSecOpsAbdullah 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
 
Python Virtual Environment.pptx
Python Virtual Environment.pptxPython Virtual Environment.pptx
Python Virtual Environment.pptxAbdullah al Mamun
 
Artificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptxArtificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptxAbdullah 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

5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteedamy56318795
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...amitlee9823
 
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...amitlee9823
 
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...gajnagarg
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...Elaine Werffeli
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...gajnagarg
 
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men 🔝Mathura🔝 Escorts...
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men  🔝Mathura🔝   Escorts...➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men  🔝Mathura🔝   Escorts...
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men 🔝Mathura🔝 Escorts...amitlee9823
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...amitlee9823
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...only4webmaster01
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 

Recently uploaded (20)

(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
 
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
 
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
 
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
 
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men 🔝Mathura🔝 Escorts...
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men  🔝Mathura🔝   Escorts...➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men  🔝Mathura🔝   Escorts...
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men 🔝Mathura🔝 Escorts...
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 

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_