SlideShare a Scribd company logo
1
 Classification:
 Predicts categorical class labels
 Classifies data (using a model) based on instance attributes to predict
class labels
 The model is induced from a training set
 The model is used to classify (predict) the class of new data
 Typical Applications of Classification
 Credit approval
 Target marketing
 Medical diagnosis/prognosis
 Treatment effectiveness analysis
Classification
2
Classification—A Two-Step Process
 (1) Model construction: describing a set of predetermined classes
 Each instance/example is assumed to belong to a predefined class, as
determined by the class label
 The set of instances used for model construction: training set
 The model is represented as classification rules, decision trees, or
mathematical formulae
 (2) Model usage: for classifying future or unknown objects
 Model Evaluation: Estimate accuracy of the model
 The known label of test sample is compared with the classified result
from the model
 Accuracy rate is the percentage of test set samples that are correctly
classified by the model
 Test set is independent of training set, otherwise over-fitting will occur
3
Classification
 Using a Classifier for Prediction
Data to be classified Classifier Decision on class
assignment
Using Hypothesis for Prediction: classifying any
example described in the same manner as the data
used in training the system (i.e. same set of features)
4
Classification
Training Set
Data with known
classes
Classification
Technique
Classifier
Data with unknown
classes
Class
Assignment
5
Naive Bayes
 Naive Bayes is a simple probabilistic classifier based on
applying Bayes' theorem (or Bayes's rule) with strong
independence (naive) assumptions
 Allows us to combine observed data and prior knowledge
 Provides practical learning algorithms
6
)
(
)
(
)
|
(
)
|
(
d
P
h
P
h
d
P
d
h
p 
)
data
the
seen
having
after
hypothesis
of
ty
(probabili
posterior
data)
the
of
y
probabilit
(marginal
evidence
data
is
hypothesis
the
if
data
the
of
ty
(probabili
likelihood
data)
any
seeing
before
hypothesis
of
ty
(probabili
belief
prior
d
h
h
h
:
)
|
(
:
)
(
)
|
(
)
(
true)
:
)
|
(
:
)
(
d
h
P
h
P
h
d
P
d
P
h
d
P
h
P
h


Who is who in Bayes’ rule sides
both
on
y
probabilit
joint
same
the
)
,
(
)
,
(
)
(
)
|
(
)
(
)
|
(
:
rearrange
Just
hypothesis
h
data
d
rule
Bayes'
ing
Understand
h
d
P
h
d
P
h
P
h
d
P
d
P
d
h
p
Proof.




Bayes’ Rule
7
Example 1
 Let h be the event of raining and d be the evidence of dark
cloud, then we have
 P(dark cloud | raining): “dark cloud” could occur in many other
events such as overcast day or forest fire. This probability can
be obtained from historical data.
 – P(raining) is the priori probability of raining. This probability
can be obtained from statistical record, for example, the
number of rainy days throughout a year.
 – P(dark cloud) is the probability of the evidence “dark cloud”
occurring.
)
(
)
(
)
|
(
)
|
(
darkCloud
P
raining
P
raining
darkCloud
P
darkCloud
raining
p 
8
More on Naive Bayes
 Generally, it is “better” to have more than one evidence to
support the prediction of an event.
 Typically, the more evidences we can gather, the better the
classification accuracy can be obtained. However, the evidence
must relate to the event (must make sense)
 When we have more than one evidence for building our NB
model, we could run into a problem of dependencies, i.e.,
some evidence may depend on one or more of other
evidences. For example, the evidence “dark cloud” directly
depends on the evidence “high humidity”.
 Dependencies can make the model a very complicated one
 Assume there are no dependencies  Naïve
9
The Naïve Bayes Classifier
 What can we do if our data d has several attributes?
 Naïve Bayes assumption: Attributes that describe data instances are
conditionally independent given the classification hypothesis
 it is a simplifying assumption, obviously it may be violated in reality
 in spite of that, it works well in practice
 The Bayesian classifier that uses the Naïve Bayes assumption and computes
the MAP hypothesis is called Naïve Bayes classifier
 One of the most practical learning methods
 Successful applications:
 Medical Diagnosis
 Text classification



t
t
T h
a
P
h
a
a
P
h
P )
|
(
)
|
,...,
(
)
|
( 1
d
10
Example. ‘Play Tennis’ data
Day Outlook Temperature Humidity Wind Play
Tennis
Day1 Sunny Hot High Weak No
Day2 Sunny Hot High Strong No
Day3 Overcast Hot High Weak Yes
Day4 Rain Mild High Weak Yes
Day5 Rain Cool Normal Weak Yes
Day6 Rain Cool Normal Strong No
Day7 Overcast Cool Normal Strong Yes
Day8 Sunny Mild High Weak No
Day9 Sunny Cool Normal Weak Yes
Day10 Rain Mild Normal Weak Yes
Day11 Sunny Mild Normal Strong Yes
Day12 Overcast Mild High Strong Yes
Day13 Overcast Hot Normal Weak Yes
Day14 Rain Mild High Strong No
11
The Probabilistic Model
12
Based on the examples in the table, classify the following datum x:
x=(Outl=Sunny, Temp=Cool, Hum=High, Wind=strong)
 That means: Play tennis or not?
 Working:
)
|
(
)
|
(
)
|
(
)
|
(
)
(
max
arg
)
|
(
)
(
max
arg
)
|
(
)
(
max
arg
]
,
[
]
,
[
]
,
[
h
strong
Wind
P
h
high
Humidity
P
h
cool
Temp
P
h
sunny
Outlook
P
h
P
h
a
P
h
P
h
P
h
P
h
no
yes
h
t
t
no
yes
h
no
yes
h
NB











x
no
x
PlayTennis
answer
no
strong
P
no
high
P
no
cool
P
no
sunny
P
no
P
yes
strong
P
yes
high
P
yes
cool
P
yes
sunny
P
yes
P
etc
no
PlayTennis
strong
Wind
P
yes
PlayTennis
strong
Wind
P
no
PlayTennis
P
yes
PlayTennis
P


















)
(
:
)
|
(
)
|
(
)
|
(
)
|
(
)
(
0053
.
0
)
|
(
)
|
(
)
|
(
)
|
(
)
(
.
60
.
0
5
/
3
)
|
(
33
.
0
9
/
3
)
|
(
36
.
0
14
/
5
)
(
64
.
0
14
/
9
)
(
0.0206
13
A Closer Look
We can ignore Pr(E) because we only need to “relatively” compare the
value to other class. :
14
Resources
 Textbook reading (contains details about using Naïve Bayes for
text classification):
Tom Mitchell, Machine Learning (book), Chapter 6.

More Related Content

PPT
bayes answer jejisiowwoowwksknejejrjejej
PPT
bayesNaive.ppt
PPT
bayesNaive.ppt
PPT
bayesNaive algorithm in machine learning
PPT
9-Decision Tree Induction-23-01-2025.ppt
PDF
Machine learning naive bayes and svm.pdf
PPTX
Naive Bayes Presentation
PPT
Unit-2.ppt
bayes answer jejisiowwoowwksknejejrjejej
bayesNaive.ppt
bayesNaive.ppt
bayesNaive algorithm in machine learning
9-Decision Tree Induction-23-01-2025.ppt
Machine learning naive bayes and svm.pdf
Naive Bayes Presentation
Unit-2.ppt

Similar to Naive Bayes_1.pptx Slides of NB in classical machine learning (20)

PPTX
Navies bayes
PPT
UNIT2_NaiveBayes algorithms used in machine learning
PDF
Naïve Bayes Machine Learning Classification with R Programming: A case study ...
PPTX
Belief Networks & Bayesian Classification
PPTX
Naive Bayesian classifier Naive Bayesian classifier Naive Bayesian classifier
PPT
NaiveBayesfcctcvtyvyuyuvuygygygiughuobiubivvyjnh
PPTX
Data Analytics with Data Science Algorithm
PPT
2.3 bayesian classification
PPT
NaiveBayes classifier for data classification
PPT
NaiveBayes.ppt
PPT
NaiveBayes.ppt
PPT
NaiveBayes.ppt Naive Bayes algorithm machine learning
PPT
NaiveBayes.ppt
PDF
NBaysian classifier, Naive Bayes classifier
PPT
NaiveBayes this is more functioonal and extraction of same version
PPTX
Naïve Bayes Classifier Algorithm.pptx
PPT
NaiveBayes classifier in artificial inteeligence.ppt
PPTX
Naïve Bayes Classifier Algorithm.pptx
PPT
BAYESIAN theorem and implementation of i
PPTX
Naïve Bayes Classification (Data Mining)
Navies bayes
UNIT2_NaiveBayes algorithms used in machine learning
Naïve Bayes Machine Learning Classification with R Programming: A case study ...
Belief Networks & Bayesian Classification
Naive Bayesian classifier Naive Bayesian classifier Naive Bayesian classifier
NaiveBayesfcctcvtyvyuyuvuygygygiughuobiubivvyjnh
Data Analytics with Data Science Algorithm
2.3 bayesian classification
NaiveBayes classifier for data classification
NaiveBayes.ppt
NaiveBayes.ppt
NaiveBayes.ppt Naive Bayes algorithm machine learning
NaiveBayes.ppt
NBaysian classifier, Naive Bayes classifier
NaiveBayes this is more functioonal and extraction of same version
Naïve Bayes Classifier Algorithm.pptx
NaiveBayes classifier in artificial inteeligence.ppt
Naïve Bayes Classifier Algorithm.pptx
BAYESIAN theorem and implementation of i
Naïve Bayes Classification (Data Mining)
Ad

Recently uploaded (20)

PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Digital Logic Computer Design lecture notes
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPT
Mechanical Engineering MATERIALS Selection
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
composite construction of structures.pdf
PDF
PPT on Performance Review to get promotions
PPTX
Construction Project Organization Group 2.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
additive manufacturing of ss316l using mig welding
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
Digital Logic Computer Design lecture notes
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Mechanical Engineering MATERIALS Selection
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
composite construction of structures.pdf
PPT on Performance Review to get promotions
Construction Project Organization Group 2.pptx
Foundation to blockchain - A guide to Blockchain Tech
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
CYBER-CRIMES AND SECURITY A guide to understanding
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
additive manufacturing of ss316l using mig welding
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Ad

Naive Bayes_1.pptx Slides of NB in classical machine learning

  • 1. 1  Classification:  Predicts categorical class labels  Classifies data (using a model) based on instance attributes to predict class labels  The model is induced from a training set  The model is used to classify (predict) the class of new data  Typical Applications of Classification  Credit approval  Target marketing  Medical diagnosis/prognosis  Treatment effectiveness analysis Classification
  • 2. 2 Classification—A Two-Step Process  (1) Model construction: describing a set of predetermined classes  Each instance/example is assumed to belong to a predefined class, as determined by the class label  The set of instances used for model construction: training set  The model is represented as classification rules, decision trees, or mathematical formulae  (2) Model usage: for classifying future or unknown objects  Model Evaluation: Estimate accuracy of the model  The known label of test sample is compared with the classified result from the model  Accuracy rate is the percentage of test set samples that are correctly classified by the model  Test set is independent of training set, otherwise over-fitting will occur
  • 3. 3 Classification  Using a Classifier for Prediction Data to be classified Classifier Decision on class assignment Using Hypothesis for Prediction: classifying any example described in the same manner as the data used in training the system (i.e. same set of features)
  • 4. 4 Classification Training Set Data with known classes Classification Technique Classifier Data with unknown classes Class Assignment
  • 5. 5 Naive Bayes  Naive Bayes is a simple probabilistic classifier based on applying Bayes' theorem (or Bayes's rule) with strong independence (naive) assumptions  Allows us to combine observed data and prior knowledge  Provides practical learning algorithms
  • 7. 7 Example 1  Let h be the event of raining and d be the evidence of dark cloud, then we have  P(dark cloud | raining): “dark cloud” could occur in many other events such as overcast day or forest fire. This probability can be obtained from historical data.  – P(raining) is the priori probability of raining. This probability can be obtained from statistical record, for example, the number of rainy days throughout a year.  – P(dark cloud) is the probability of the evidence “dark cloud” occurring. ) ( ) ( ) | ( ) | ( darkCloud P raining P raining darkCloud P darkCloud raining p 
  • 8. 8 More on Naive Bayes  Generally, it is “better” to have more than one evidence to support the prediction of an event.  Typically, the more evidences we can gather, the better the classification accuracy can be obtained. However, the evidence must relate to the event (must make sense)  When we have more than one evidence for building our NB model, we could run into a problem of dependencies, i.e., some evidence may depend on one or more of other evidences. For example, the evidence “dark cloud” directly depends on the evidence “high humidity”.  Dependencies can make the model a very complicated one  Assume there are no dependencies  Naïve
  • 9. 9 The Naïve Bayes Classifier  What can we do if our data d has several attributes?  Naïve Bayes assumption: Attributes that describe data instances are conditionally independent given the classification hypothesis  it is a simplifying assumption, obviously it may be violated in reality  in spite of that, it works well in practice  The Bayesian classifier that uses the Naïve Bayes assumption and computes the MAP hypothesis is called Naïve Bayes classifier  One of the most practical learning methods  Successful applications:  Medical Diagnosis  Text classification    t t T h a P h a a P h P ) | ( ) | ,..., ( ) | ( 1 d
  • 10. 10 Example. ‘Play Tennis’ data Day Outlook Temperature Humidity Wind Play Tennis Day1 Sunny Hot High Weak No Day2 Sunny Hot High Strong No Day3 Overcast Hot High Weak Yes Day4 Rain Mild High Weak Yes Day5 Rain Cool Normal Weak Yes Day6 Rain Cool Normal Strong No Day7 Overcast Cool Normal Strong Yes Day8 Sunny Mild High Weak No Day9 Sunny Cool Normal Weak Yes Day10 Rain Mild Normal Weak Yes Day11 Sunny Mild Normal Strong Yes Day12 Overcast Mild High Strong Yes Day13 Overcast Hot Normal Weak Yes Day14 Rain Mild High Strong No
  • 12. 12 Based on the examples in the table, classify the following datum x: x=(Outl=Sunny, Temp=Cool, Hum=High, Wind=strong)  That means: Play tennis or not?  Working: ) | ( ) | ( ) | ( ) | ( ) ( max arg ) | ( ) ( max arg ) | ( ) ( max arg ] , [ ] , [ ] , [ h strong Wind P h high Humidity P h cool Temp P h sunny Outlook P h P h a P h P h P h P h no yes h t t no yes h no yes h NB            x no x PlayTennis answer no strong P no high P no cool P no sunny P no P yes strong P yes high P yes cool P yes sunny P yes P etc no PlayTennis strong Wind P yes PlayTennis strong Wind P no PlayTennis P yes PlayTennis P                   ) ( : ) | ( ) | ( ) | ( ) | ( ) ( 0053 . 0 ) | ( ) | ( ) | ( ) | ( ) ( . 60 . 0 5 / 3 ) | ( 33 . 0 9 / 3 ) | ( 36 . 0 14 / 5 ) ( 64 . 0 14 / 9 ) ( 0.0206
  • 13. 13 A Closer Look We can ignore Pr(E) because we only need to “relatively” compare the value to other class. :
  • 14. 14 Resources  Textbook reading (contains details about using Naïve Bayes for text classification): Tom Mitchell, Machine Learning (book), Chapter 6.