Skip to content
Iris flowers classification with machine learning using Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This project consists of a classification of iris flowers with machine learning algorithms in Python.

The data set used for this project is the Bezdek variation of the world famous Iris flower data set introduced by Ronald Fisher in 1936. The original data set made by Fisher is also included in the data folder of the project.

Getting started

These instructions will get you a copy of the project up and running on your local machine.


You need to have installed Python 3. This version is installed by default on modern versions of Ubuntu.

To check if you have Python 3 already installed, use the following command.

python3 --version

If your terminal returns the sentence "Python 3.X.Y" (being X and Y two positive numbers) or something similar, you're done!

Otherwise, you would need to install it using the following command line:

sudo apt-get install python3


Besides from the prerequisites, you won't need any other applications to run the program.

Simply download or clone the project to a folder of your local machine.

If you want to clone the project into an empty folder, execute the following command:

git clone

If the folder isn't empty, execute the following commands to clone the project:

git init
git remote add origin
git fetch
git checkout -t origin/master

Now you are ready to execute the project!


To run the project, open a terminal window in "src" folder and type the following command:


Optional arguments

You can use additional options in the arguments of the program. The following are the optional arguments supported:

  • -h / --help: Shows a help message about the usage of the program. This argument will stop the execution of the program.

      python3 --help
  • -o / --original: Uses original data set made by Ronald Fisher instead of the default data set.

      python3 --original
  • -r RATIO / --ratio RATIO: Changes the split ratio between the training set and the test set. This value must be between 0.0 and 1.0. Its default value is 0.66.

      python3 -r 0.82
  • -k NEIGHBOURS / --neighbours NEIGHBOURS: Changes the "k" value for the kNN algorithm. This value must be a positive integer. Its default value is 3.

      python3 -k 5

The combination of this optional arguments is also allowed, as you can see in the following example:

python3 --original -r 0.75 -k 4


See also the list of the contributors who participated in this project.


This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.


  • UCI Machine Learning Repository for the data
  • Machine Learning Mastery for the tutorial and the starting idea
  • StackOverflow and its community for all the help
  • PurpleBooth@Github for this template
You can’t perform that action at this time.