Nearest
ea es Neighbor
eg o
z Examples:
Rote learner
memorize entire training data
perform classification only if attributes of test
sample match one of the training samples exactly
Nearest neighbor
g
use k closest samples (nearest neighbors) to
perform classification
z Basic idea:
If it walks like a duck
duck, quacks like a duck
duck, then
its probably a duck
compute
distance test
sample
X X X
(a) 1-nearest
1 nearest neighbor (b) 2-nearest
2 nearest neighbor (c) 3
3-nearest
nearest neighbor
Voronoi diagram
z Scaling issues
Attributes may have to be scaled to prevent
distance measures from being dominated by
one of the attributes
Example:
height
g of a pperson mayy vary
y from 1.5 m to 1.8 m
weight of a person may vary from 90 lb to 300 lb
111111111110 100000000000
vs
011111111111 000000000001
d = 1.4142 d = 1.4142
No 2 4 1 No 3 4
i =1
gglobal local
stable accurate
can be inaccurate unstable
What ultimately
ltimatel matters
matters: GENERALIZATION