Member-only story

Building a k-Nearest Neighbor algorithm with the Iris dataset.

Kristian Roopnarine
5 min readOct 28, 2019

Classifying the Iris flowers using the k- Nearest Neighbor machine learning algorithm.

Visual of kNN (Image Credit)

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.

--

--

Kristian Roopnarine
Kristian Roopnarine

Written by Kristian Roopnarine

Full Stack Engineer sharing tips and tricks for anyone learning to program. Connect with me on LinkedIn : https://www.linkedin.com/in/kristianroopnarine/

No responses yet