SlideShare a Scribd company logo
6
Most read
7
Most read
8
Most read
Data Mining
Bayes Classification
Baye's Theorem
 Bayes' Theorem is named after Thomas Bayes.There are
two types of probabilities −
 Posterior Probability [P(H/X)]
 Prior Probability [P(H)]
 where X is data tuple and H is some hypothesis.
 According to Bayes' Theorem,
 P(H/X)= P(X/H)P(H) / P(X)
Naïve Bayes
 It is a classification technique based on Bayes’ Theorem with an
assumption of independence among predictors.
 In simple terms, a Naive Bayes classifier assumes that the
presence of a particular feature in a class is unrelated to the
presence of any other feature.
 For example, a fruit may be considered to be an apple if it is
red, round, and about 3 inches in diameter. Even if these
features depend on each other or upon the existence of the
other features, all of these properties independently
contribute to the probability that this fruit is an apple and that
is why it is known as ‘Naive’.
 Naive Bayes model is easy to build and particularly useful for
very large data sets. Along with simplicity, Naive Bayes is
known to outperform even highly sophisticated classification
methods.
 Bayes theorem provides a way of calculating posterior
probability P(c|x) from P(c), P(x) and P(x|c). Look at the
equation below:
Formula
Formula
 P(c|x) is the posterior probability of class (c, target) given
predictor (x, attributes).
 P(c) is the prior probability of class.
 P(x|c) is the likelihood which is the probability of predictor
given class.
 P(x) is the prior probability of predictor.
Dataset
Day Outlook Temperature Humidity Wind Class: Play ball
D1 Sunny Hot High False No
D2 Sunny Hot High True No
D3 Overcast Hot High False Yes
D4 Rain Mild High False Yes
D5 Rain Cool Normal False Yes
D6 Rain Cool Normal True No
D7 Overcast Cool Normal True Yes
D8 Sunny Mild High False No
D9 Sunny Cool Normal False Yes
D10 Rain Mild Normal False Yes
D11 Sunny Mild Normal True Yes
D12 Overcast Mild High True Yes
D13 Overcast Hot Normal False Yes
D14 Rain Mild High True No
Problem
The weather data, with counts and probabilities
outlook temperature humidity windy play
yes no yes no yes no yes no yes no
sunny 2 3 hot 2 2 high 3 4 false 6 2 9 5
overcast 4 0 mild 4 2 normal 6 1 true 3 3
rainy 3 2 cool 3 1
sunny 2/9 3/5 hot 2/9 2/5 high 3/9 4/5 false 6/9 2/5 9/14 5/14
overcast 4/9 0/5 mild 4/9 2/5 normal 6/9 1/5 true 3/9 3/5
rainy 3/9 2/5 cool 3/9 1/5
A new day
outlook temperature humidity windy play
sunny cool high true ?
Outlook Temp Humidity Wind
Overcast Mild Normal True
Problem
P(outlook=Sunny|Yes) = 2/9
P(temp=cool|yes) = 3/9
P(humidity=high|yes)=3/9
P(Windy=true|yes)=3/9
P(outlook=Sunny|temp=cool|humidity=high|Windy=true|Yes)=2/9*3/9*3/9*3/9*9/14
= 0.00529
P(outlook=Sunny|No) = 3/5
P(temp=cool|No) = 1/5
P(humidity=high|No)= 4/5
P(Windy=true|No)= 3/5
P(outlook=Sunny|temp=cool|humidity=high|Windy=true|No) =
3/5*1/5*4/5*3/5*5/14 = 0.0206
P(Yes)<P(No)
Prediction = No
 Likelihood of yes
 Likelihood of no
 Therefore, the prediction is No
0053
.
0
14
9
9
3
9
3
9
3
9
2






0206
.
0
14
5
5
3
5
4
5
1
5
3






 Predict stolen for
 Color=red
 Type=suv
 Origin=domestic
Color Type Origin
Yes No Yes No Yes No
Red 3 2 Sports 4 2 Dom 2 3
Yellow 2 3 SUV 1 3 Imp 3 2
Red 3/5 2/5 Sports 4/6 2/6 Dom 2/5 3/5
Yellow 2/5 3/5 SUV 1/4 3/4 Imp 3/5 2/5
Total Rows = 10
P(Yes) = 5/10
P(No) = 5/10
Predict stolen for
Likelihood forYes
Color=red = 3/5
Type=suv = 1/4
Origin=domestic = 2/5
P(X|Yes) = 3/5*1/4*2/5*5/10 = 0.003
Likelihood for No
Color=red = 2/5
Type=suv = 3/4
Origin=domestic = 3/5
P(X|No) = 2/5*3/4*3/5*5/10 = 0.033
Prediction = Stolen = No

More Related Content

PDF
Optimization for Deep Learning
PPTX
Multilayer perceptron
PDF
Introduction to pattern recognition
DOCX
Chapter 4: Enhanced Entity-Relationship and Object Modeling
PPTX
Fourth Normal Form.pptx
PDF
Lecture11
PPTX
Machine Learning vs. Deep Learning
PPTX
ML - Simple Linear Regression
Optimization for Deep Learning
Multilayer perceptron
Introduction to pattern recognition
Chapter 4: Enhanced Entity-Relationship and Object Modeling
Fourth Normal Form.pptx
Lecture11
Machine Learning vs. Deep Learning
ML - Simple Linear Regression

What's hot (20)

PPSX
Edge Detection and Segmentation
PDF
Data Mining: Association Rules Basics
PPT
lecture07.ppt
PPTX
Introduction Of Artificial neural network
PPTX
Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...
PPTX
Deep Learning in Computer Vision
PDF
NN_02_Threshold_Logic_Units.pdf
PPTX
Optics
PPT
Chapter10 conceptual data modeling
PDF
Closest pair problems (Divide and Conquer)
PPTX
Entity Relationship design issues
PPTX
Lecture 1 ddbms
PDF
2 lectures 16 17-informed search algorithms ch 4.3
PPTX
Deep neural networks
PPTX
Fyp 2 presentation
PPTX
Data mining query language
PPTX
Introduction to datastructure and algorithm
PPT
10 color image processing
ODP
Implementation Issue with ORDBMS
Edge Detection and Segmentation
Data Mining: Association Rules Basics
lecture07.ppt
Introduction Of Artificial neural network
Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...
Deep Learning in Computer Vision
NN_02_Threshold_Logic_Units.pdf
Optics
Chapter10 conceptual data modeling
Closest pair problems (Divide and Conquer)
Entity Relationship design issues
Lecture 1 ddbms
2 lectures 16 17-informed search algorithms ch 4.3
Deep neural networks
Fyp 2 presentation
Data mining query language
Introduction to datastructure and algorithm
10 color image processing
Implementation Issue with ORDBMS
Ad

Similar to Module 4 bayes classification (20)

PDF
Naive bayes Naive bayes Naive bayes Naive bayes
PDF
Dwdm naive bayes_ankit_gadgil_027
PPT
3.Classification.ppt
PPTX
weatherr.pptx
PPTX
Naive bayes algorithm machine learning.pptx
PDF
Naïve Bayes Machine Learning Classification with R Programming: A case study ...
PPTX
Classification Algorithm.
PDF
PPTX
Belief Networks & Bayesian Classification
PPTX
Classifcation Algorithms in Data Mining Couse
PPTX
baysian in machine learning in Supervised Learning .pptx
PPTX
Naïve Bayes Classification (Data Mining)
PPT
NaiveBayesfcctcvtyvyuyuvuygygygiughuobiubivvyjnh
PPT
NaiveBayes.ppt
PPT
NaiveBayes.ppt
PPT
NaiveBayes.ppt Naive Bayes algorithm machine learning
PPT
NaiveBayes.ppt
PPT
NaiveBayes classifier in artificial inteeligence.ppt
PPTX
Data Analytics with Data Science Algorithm
PPTX
Naive bayes
Naive bayes Naive bayes Naive bayes Naive bayes
Dwdm naive bayes_ankit_gadgil_027
3.Classification.ppt
weatherr.pptx
Naive bayes algorithm machine learning.pptx
Naïve Bayes Machine Learning Classification with R Programming: A case study ...
Classification Algorithm.
Belief Networks & Bayesian Classification
Classifcation Algorithms in Data Mining Couse
baysian in machine learning in Supervised Learning .pptx
Naïve Bayes Classification (Data Mining)
NaiveBayesfcctcvtyvyuyuvuygygygiughuobiubivvyjnh
NaiveBayes.ppt
NaiveBayes.ppt
NaiveBayes.ppt Naive Bayes algorithm machine learning
NaiveBayes.ppt
NaiveBayes classifier in artificial inteeligence.ppt
Data Analytics with Data Science Algorithm
Naive bayes
Ad

More from SatishH5 (11)

PDF
Some study materials
PDF
Regression2
PDF
Regression trees lot example
PDF
Regression trees
DOCX
Regression trees
PDF
Regression tree
PDF
Multi linear regression
PDF
Knn classification
PDF
Knn classification (1)
PDF
Decision trees
PDF
Decision tree cart c4.5
Some study materials
Regression2
Regression trees lot example
Regression trees
Regression trees
Regression tree
Multi linear regression
Knn classification
Knn classification (1)
Decision trees
Decision tree cart c4.5

Recently uploaded (20)

PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Digital Strategies for Manufacturing Companies
PPTX
Operating system designcfffgfgggggggvggggggggg
PPT
Introduction Database Management System for Course Database
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Transform Your Business with a Software ERP System
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
assetexplorer- product-overview - presentation
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Which alternative to Crystal Reports is best for small or large businesses.pdf
Digital Strategies for Manufacturing Companies
Operating system designcfffgfgggggggvggggggggg
Introduction Database Management System for Course Database
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
CHAPTER 2 - PM Management and IT Context
Designing Intelligence for the Shop Floor.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Transform Your Business with a Software ERP System
Wondershare Filmora 15 Crack With Activation Key [2025
assetexplorer- product-overview - presentation
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Design an Analysis of Algorithms I-SECS-1021-03
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
VVF-Customer-Presentation2025-Ver1.9.pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises

Module 4 bayes classification

  • 2. Baye's Theorem  Bayes' Theorem is named after Thomas Bayes.There are two types of probabilities −  Posterior Probability [P(H/X)]  Prior Probability [P(H)]  where X is data tuple and H is some hypothesis.  According to Bayes' Theorem,  P(H/X)= P(X/H)P(H) / P(X)
  • 3. Naïve Bayes  It is a classification technique based on Bayes’ Theorem with an assumption of independence among predictors.  In simple terms, a Naive Bayes classifier assumes that the presence of a particular feature in a class is unrelated to the presence of any other feature.  For example, a fruit may be considered to be an apple if it is red, round, and about 3 inches in diameter. Even if these features depend on each other or upon the existence of the other features, all of these properties independently contribute to the probability that this fruit is an apple and that is why it is known as ‘Naive’.  Naive Bayes model is easy to build and particularly useful for very large data sets. Along with simplicity, Naive Bayes is known to outperform even highly sophisticated classification methods.
  • 4.  Bayes theorem provides a way of calculating posterior probability P(c|x) from P(c), P(x) and P(x|c). Look at the equation below: Formula
  • 5. Formula  P(c|x) is the posterior probability of class (c, target) given predictor (x, attributes).  P(c) is the prior probability of class.  P(x|c) is the likelihood which is the probability of predictor given class.  P(x) is the prior probability of predictor.
  • 6. Dataset Day Outlook Temperature Humidity Wind Class: Play ball D1 Sunny Hot High False No D2 Sunny Hot High True No D3 Overcast Hot High False Yes D4 Rain Mild High False Yes D5 Rain Cool Normal False Yes D6 Rain Cool Normal True No D7 Overcast Cool Normal True Yes D8 Sunny Mild High False No D9 Sunny Cool Normal False Yes D10 Rain Mild Normal False Yes D11 Sunny Mild Normal True Yes D12 Overcast Mild High True Yes D13 Overcast Hot Normal False Yes D14 Rain Mild High True No
  • 7. Problem The weather data, with counts and probabilities outlook temperature humidity windy play yes no yes no yes no yes no yes no sunny 2 3 hot 2 2 high 3 4 false 6 2 9 5 overcast 4 0 mild 4 2 normal 6 1 true 3 3 rainy 3 2 cool 3 1 sunny 2/9 3/5 hot 2/9 2/5 high 3/9 4/5 false 6/9 2/5 9/14 5/14 overcast 4/9 0/5 mild 4/9 2/5 normal 6/9 1/5 true 3/9 3/5 rainy 3/9 2/5 cool 3/9 1/5 A new day outlook temperature humidity windy play sunny cool high true ? Outlook Temp Humidity Wind Overcast Mild Normal True
  • 8. Problem P(outlook=Sunny|Yes) = 2/9 P(temp=cool|yes) = 3/9 P(humidity=high|yes)=3/9 P(Windy=true|yes)=3/9 P(outlook=Sunny|temp=cool|humidity=high|Windy=true|Yes)=2/9*3/9*3/9*3/9*9/14 = 0.00529 P(outlook=Sunny|No) = 3/5 P(temp=cool|No) = 1/5 P(humidity=high|No)= 4/5 P(Windy=true|No)= 3/5 P(outlook=Sunny|temp=cool|humidity=high|Windy=true|No) = 3/5*1/5*4/5*3/5*5/14 = 0.0206 P(Yes)<P(No) Prediction = No
  • 9.  Likelihood of yes  Likelihood of no  Therefore, the prediction is No 0053 . 0 14 9 9 3 9 3 9 3 9 2       0206 . 0 14 5 5 3 5 4 5 1 5 3      
  • 10.  Predict stolen for  Color=red  Type=suv  Origin=domestic
  • 11. Color Type Origin Yes No Yes No Yes No Red 3 2 Sports 4 2 Dom 2 3 Yellow 2 3 SUV 1 3 Imp 3 2 Red 3/5 2/5 Sports 4/6 2/6 Dom 2/5 3/5 Yellow 2/5 3/5 SUV 1/4 3/4 Imp 3/5 2/5 Total Rows = 10 P(Yes) = 5/10 P(No) = 5/10 Predict stolen for Likelihood forYes Color=red = 3/5 Type=suv = 1/4 Origin=domestic = 2/5 P(X|Yes) = 3/5*1/4*2/5*5/10 = 0.003 Likelihood for No Color=red = 2/5 Type=suv = 3/4 Origin=domestic = 3/5 P(X|No) = 2/5*3/4*3/5*5/10 = 0.033 Prediction = Stolen = No