DEVNET.

Predicting Values By Using k-nearest Neighbors Machine Learning Algorithm

The k-nearest neighbors algorithm (k-NN) is a non-parametric method used for classification and regression in machine learning. This is the simplest and easiest algorithm which can be used to predict the outcome values. K-NN is also known as lazy learning, which stores the training data and waits until given a test tuple.

K-Nearest Neighbor Algorithm Has Below Mentioned Steps:
1. Pick a value of K
2. Search for K observations in the training data that are nearest to the measurements of the unknown data
3. Use the most popular response value from the K nearest neighbors as presicted response value for the unknown data or iris data in our example.
In the previous post we have loaded our first dataset which is IRIS. Now use the same dataset to train our model by using KNN neighbor algorithm and predict the values or outcomes. Click here to check which algorithm is used when.

Follow the code as explained in the previous post to load the IRIS dataset by using Scikit Learn.

# Below code will load the 4 attributes of IRIS in x_train_data object. The same can be verifies by using shape command

Share:

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

Become a member

Full Access to 739 Lessons. New Lessons Added Every Week!

Awesome Deal! Get 2 Months for FREE!

No Obligations. Cancel At Any Time!