K Nearest Neighbors From Scratch¶
KNN is a conceptually simple but effective algorithm that is commonly used in classification tasks. With existing knowledge about how data points of different classes are located in different clusters, we make predictions on the classes of new data points. Basic requisite for KNN to work well:
- Different classes indeed form well-isolated clusters
- We have a good distance function such that d(p1, p2) is small when p1 and p2 are from the same class and big when p1 and p2 are from different classes.
In [ ]:
Copied!