WK 6 Nearest Neighbor Classifier and Bayesian Classifier 1 PPT
WK 6 Nearest Neighbor Classifier and Bayesian Classifier 1 PPT
• Bayesian Classifier
Recommended Reading
● Basic idea:
– If it walks like a duck, quacks like a duck, then
it’s probably a duck
Compute
Distance Test
Record
● Scaling issues
– Attributes may have to be scaled to prevent
distance measures from being dominated by
one of the attributes
– Example:
◆ height of a person may vary from 1.5m to 1.8m
◆ weight of a person may vary from 90lb to 300lb
● 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
● Approach:
– compute the posterior probability P(C | A1, A2, …, An) for
all values of C using the Bayes theorem
● Normal distribution:
● P(X|Class=No) = P(Refund=No|Class=No)
× P(Married| Class=No)
× P(Income=120K| Class=No)
= 4/7 × 4/7 × 0.0072 = 0.0024
n: number of instances
from class yj
p: prior probability
m: parameter
nc: is the number of
training examples from
class yj
A: attributes
M: mammals
N: non-mammals