Chapter 16: k Nearest Neighbours (kNN)
In this chapter, we will understand the math behind kNN. kNN is k nearest neighbor. k nearest neighbor is used both in a classification supervised learning algorithm and in unsupervised learning.
Let us understand this algorithm using an example. In the picture below, we are trying to find whether the green ball will go to the blue group or the red group. That decision will be based on the distance between the green ball and the nearest blue & red balls. The concept of Euclidean distance will be used to find the distance.
The formula for Euclidian distance is
Euclidean distance is the shortest between the ...
Get De-Mystifying Math and Stats for Machine Learning now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.