Implementation of KNN algorithm in Python 3
- K-Nearest-Neighbors algorithm is used for classification and regression problems.
- In this project, it is used for classification.
- The Iris data set is bundled for test, however you are free to use any data set of your choice provided that it follows the specified format.
- CSV (Comma Separated Values) format.
- Attributes can be integer or real values.
- List attributes first, and add response as the last parameter in each row.
- E.g. [4.5, 7, 2.6, "Orange"], where the first 3 numbers are values of attributes and "Orange" is one of the response classes.
- Another example can be [1.2, 4.3, 3], in this case there are 2 attributes while the response class is the integer 3.
- The square brackets are shown for convenience in reading, don't put them in your CSV file.
- Responses can be integer, real or categorical.
- The Iris data set is provided in the repository.
- Enter 'iris-dataset.csv' when asked for training data file name.
- Enter 'iris-test.csv' when asked for test data file name.
- Keep the data set files in the working directory of project as defined by the IDE configuration.
- When running in stand alone mode (E.g. command line), keep the data sets in the same directory as the script.