Example for Classification - Whether tissue is good? (3,7)
xyClass
77Bad
74Bad
34Good
14Good
(7,7) |7-3| + |7-7| = 0 Bad
(7,4) |7-3| + |4-7| = 7 Bad
(3,4) |3-3| + |4-7| = 3 Good
(1,4) |1-3| +|4-7| = 5 Good
Basic Idea
●k-NN classification rule is to assign to a test sample
the majority category label of its k nearest training
samples
●In practice, k is usually chosen to be odd, so as to
avoid ties
●The k = 1 rule is generally called the nearest-neighbor
classification rule
Steps
Key points
○K-NN is a non-parametric algorithm, which means it does not make any assumption on
underlying data.
○It is also called a lazy learner algorithm because it does not learn from the training set
immediately instead it stores the dataset and at the time of classification, it performs
an action on the dataset.
○KNN algorithm at the training phase just stores the dataset and when it gets new data,
then it classifies that data into a category that is much similar to the new data.