Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 1.96 KB

File metadata and controls

25 lines (21 loc) · 1.96 KB

K-Nearest Neighbors

Repository containing examples of KNN Algorithm

What is KNN?

K Nearest Neighbor(KNN) is a very simple, easy to understand, versatile and one of the topmost machine learning algorithms. KNN used in the variety of applications such as finance, healthcare, political science, handwriting detection, image recognition and video recognition. In Credit ratings, financial institutes will predict the credit rating of customers. In loan disbursement, banking institutes will predict whether the loan is safe or risky. In political science, classifying potential voters in two classes will vote or won’t vote. KNN algorithm used for both classification and regression problems. KNN algorithm based on feature similarity approach. KNN-Image Example

Theory

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 e.g Euclidean or Manhattan etc. 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.

Euclidean distance

Required DataSets for this repository

Required libraries

Scikit-learn library

pip install -U scikit-learn

Imutils

pip install imutils