K-Nearest Neighbour's Algorithm
K-Nearest Neighbour's Algorithm
Algorithm
KNN Brief
• The intuition behind the KNN algorithm is one of the simplest of all the
supervised machine learning algorithms.
• It simply calculates the distance of a new data point to all other training data
points. The distance can be of any type.
• It then selects the K-nearest data points, where K can be any integer. Finally
it assigns the data point to the class to which the majority of the K data
points belong.
Pro’s Of KNN
• The KNN algorithm doesn't work well with high dimensional data because
with large number of dimensions, it becomes difficult for the algorithm to
calculate distance in each dimension.
• The KNN algorithm has a high prediction cost for large datasets. This is
because in large datasets the cost of calculating distance between new
point and each existing point becomes higher.
• Finally, the KNN algorithm doesn't work well with categorical features since
it is difficult to find the distance between dimensions with categorical
features