In this project, Naive Bayes classifier and K-Nearest Neighbors classifier are implemented with using Iris dataset.
- Numpy, scipy and sklearn libraries are downloaded.
- Dataset is shuffled.
- 5-fold cross validation is implemented. (4 parts are train set; 1 part is test set)
- Iris dataset values are converted from float to integer.
- The model is trained.
- The class is predicted for each item in test set.
- K-Nearest Neighbors are calculated.
To calculate KNN for k=3, it is needed to calculate the nearest three neighbors of the given item. Euclidian distance function is used to do this. Then, the most frequent class value is selected for the item in test set.