Member-only story
Building a k-Nearest Neighbor algorithm with the Iris dataset.
Classifying the Iris flowers using the k- Nearest Neighbor machine learning algorithm.
The Iris dataset
A well known data set that contains 150 records of three species of Iris flowers Iris Setosa , Iris Virginica and Iris Versicolor. There are 50 records for each Iris species and every record contains four features, the pedal length and width, the sepal length and width. We are going to use a k-Nearest neighbors algorithm to classify these species based on these four features.
The code for this project can be found in my GitHub:
k-Nearest Neighbors
kNN is probably the most simplistic machine learning algorithm because it doesn’t make any mathematical assumptions and doesn’t require heavy machinery. It just requires an understanding of distances between points which are the Euclidian or Manhattan distances. The only assumption for this algorithm is:
The points that are close to one another are similar.