Naïve Bayes Classifier �
Applications
2
3
Outline
4
Background
Examples: k-NN, decision trees, perceptron, SVM
b) Model the probability of class memberships given input data
Example: perceptron with the cross-entropy cost
c) Make a probabilistic model of data within each class
Examples: naive Bayes, model based classifiers
5
Probability Basics
6
Discriminative
Generative
Probability Basics
7
Probabilistic Classification
8
Discriminative
Probabilistic Classifier
Probabilistic Classification…
9
Generative
Probabilistic Model
for Class 1
Generative
Probabilistic Model
for Class L
Probabilistic Classification…
10
Common factor for all L probabilities
Naïve Bayes
11
Example 1
12
Consider the data given in table and classify a sample x={M, 1.95m)
Example 1
13
Consider the data given in table and classify a sample x={M, 1.95m)
Example 1…
14
Example 1…
15
Example 1…
16
Using MAP
Example 2
17
x’=(Outlook=Sunny, Temperature=Cool, Humidity=High, Wind=Strong)
Example 2…
18
Outlook | Play=Yes | Play=No |
Sunny | 2/9 | 3/5 |
Overcast | 4/9 | 0/5 |
Rain | 3/9 | 2/5 |
Temperature | Play=Yes | Play=No |
Hot | 2/9 | 2/5 |
Mild | 4/9 | 2/5 |
Cool | 3/9 | 1/5 |
Humidity | Play=Yes | Play=No |
High | 3/9 | 4/5 |
Normal | 6/9 | 1/5 |
Wind | Play=Yes | Play=No |
Strong | 3/9 | 3/5 |
Weak | 6/9 | 2/5 |
P(Play=Yes) = 9/14
P(Play=No) = 5/14
x’=(Outlook=Sunny, Temperature=Cool, Humidity=High, Wind=Strong)
Example 2…
19
x’=(Outlook=Sunny, Temperature=Cool, Humidity=High, Wind=Strong)
P(Outlook=Sunny|Play=No) = 3/5
P(Temperature=Cool|Play==No) = 1/5
P(Huminity=High|Play=No) = 4/5
P(Wind=Strong|Play=No) = 3/5
P(Play=No) = 5/14
P(Outlook=Sunny|Play=Yes) = 2/9
P(Temperature=Cool|Play=Yes) = 3/9
P(Huminity=High|Play=Yes) = 3/9
P(Wind=Strong|Play=Yes) = 3/9
P(Play=Yes) = 9/14
P(Yes|x’) ≈ [P(Sunny|Yes)P(Cool|Yes)P(High|Yes)P(Strong|Yes)]P(Play=Yes) = 0.0053
P(No|x’) ≈ [P(Sunny|No) P(Cool|No)P(High|No)P(Strong|No)]P(Play=No) = 0.0206
Given the fact P(Yes|x’) < P(No|x’), we label x’ to be “No”.
�Zero Conditional Probability…
20
(m-estimate)
�Zero conditional probability…
21
Summary
22