I believe you might have read my previous article on KNN classifier. So, this is the next part of that where we are dealing with implementation of it in Python.
My other machine learning articles will be posted here.
The required data set to run this program can be found here: train.txt and test.txt .
DISCLAIMER: I DON'T OWN THE DATASET.
The above data set was DERIVED from the famous Iris Flower dataset .
This program uses Matplotlib and Numpy.
If you have not installed (on Ubuntu OS), install it using the following commands:
The program is as follows:
Output:
Plot:
Please leave a comment if you find this article useful.
My other machine learning articles will be posted here.
The required data set to run this program can be found here: train.txt and test.txt .
DISCLAIMER: I DON'T OWN THE DATASET.
The above data set was DERIVED from the famous Iris Flower dataset .
This program uses Matplotlib and Numpy.
If you have not installed (on Ubuntu OS), install it using the following commands:
sudo apt-get install python-matplotlib sudo apt-get install python-numpy sudo apt-get install python-scipy
The program is as follows:
Output:
Plot:
If you observe, you can see that as value of k increases, accuracy increases to some extent and then doesn't increase after that (in fact decreases).
Please leave a comment if you find this article useful.