Naive Bayes
Naive Bayes
P( A | C ) P(C )
P(C | A) =
P( A)
Example of Bayes Theorem
• Given:
• A doctor knows that meningitis causes stiff neck 50% of the time
• Prior probability of any patient having meningitis is 1/50,000
• Prior probability of any patient having stiff neck is 1/20
P( S | M ) P( M ) 0.5 ×1 / 50000
P( M | S ) = = = 0.0002
P( S ) 1 / 20
Bayesian Classifiers
• Consider each attribute and class label as random
variables
P( A A ! A )
1 2 n
1 2 n
P(Refund=Yes|Yes)=0
How to Estimate Probabilities from Data?
e e t as
c at c at c o n
c l
Tid Refund Marital Taxable
Evade
• Normal distribution:
Status Income
1 −
( Ai − µ ij ) 2
2πσ
i j 2
2 No Married 100K No
ij
3 No Single 70K No
• One for each (Ai,ci) pair
4 Yes Married 120K No
5 No Divorced 95K Yes
• For (Income, Class=No):
6 No Married 60K No
• If Class=No
7 Yes Divorced 220K No
• sample mean = 110
8 No Single 85K Yes
• sample variance = 2975
9 No Married 75K No
10 No Single 90K Yes
10
1 −
( 120 −110 ) 2
Give Birth Can Fly Live in Water Have Legs Class P(A|M)P(M) > P(A|N)P(N)
yes no yes no ?
=> Mammals
Naïve Bayes (Summary)
• Robust to isolated noise points