July 2018
Beginner to intermediate
146 pages
3h 39m
English

k-NN classification is best explained with the help of an example. Consider a dataset that has binary classes (represented as the blue squares and the red triangles). k-NN now plots this into n-dimensional space (in this case, two dimensions).
Let's say we want to predict the class of the green circle. Before the k-NN algorithm can make predictions, it needs to know the number of nearest neighbors that have to be taken into consideration (the value of k). k is usually odd (to avoid ties in the case of binary classification).
Consider the case where k=3.
k-NN computes the distance metric (usually the Euclidean distance) from ...
Read now
Unlock full access