SlideShare a Scribd company logo
1 of 11
Download to read offline
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

More from SatishH5 (10)

Regression2
Regression2Regression2
Regression2
ย 
Regression trees lot example
Regression trees lot exampleRegression trees lot example
Regression trees lot example
ย 
Regression trees
Regression treesRegression trees
Regression trees
ย 
Regression trees
Regression treesRegression trees
Regression trees
ย 
Regression tree
Regression treeRegression tree
Regression tree
ย 
Multi linear regression
Multi linear regressionMulti linear regression
Multi linear regression
ย 
Knn classification
Knn classificationKnn classification
Knn classification
ย 
Knn classification (1)
Knn classification (1)Knn classification (1)
Knn classification (1)
ย 
Decision trees
Decision treesDecision trees
Decision trees
ย 
Decision tree cart c4.5
Decision tree   cart c4.5Decision tree   cart c4.5
Decision tree cart c4.5
ย 

Recently uploaded

CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online โ˜‚๏ธ
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online  โ˜‚๏ธCALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online  โ˜‚๏ธ
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online โ˜‚๏ธ
anilsa9823
ย 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
ย 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
bodapatigopi8531
ย 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
ย 

Recently uploaded (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
ย 
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online โ˜‚๏ธ
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online  โ˜‚๏ธCALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online  โ˜‚๏ธ
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online โ˜‚๏ธ
ย 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
ย 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
ย 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
ย 
Vip Call Girls Noida โžก๏ธ Delhi โžก๏ธ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida โžก๏ธ Delhi โžก๏ธ 9999965857 No Advance 24HRS LiveVip Call Girls Noida โžก๏ธ Delhi โžก๏ธ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida โžก๏ธ Delhi โžก๏ธ 9999965857 No Advance 24HRS Live
ย 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
ย 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...
ย 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
ย 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
ย 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
ย 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
ย 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
ย 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
ย 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
ย 
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
ย 
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธcall girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
ย 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
ย 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
ย 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
ย 

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