Question
Implement a k-nearest neighbor classifier for k=1,3,5 on the Iris dataset available from UCI Machine Learning repository in the iris.data file at http://archive.ics.uci.edu/ml/machine-learning-databases/iris/ . This
Implement a k-nearest neighbor classifier for k=1,3,5 on the Iris dataset available from UCI Machine Learning repository in the iris.data file at http://archive.ics.uci.edu/ml/machine-learning-databases/iris/ . This dataset consists of 3 classes of 50 examples each (150 examples total) where each class is a type of an Iris plant (more information about the dataset can be found in the iris.names file). Divide the dataset into a training set and the testing set of 75 examples each such that the training and the testing set will have 25 examples of each class. Report the percent accuracy ((# correctly classified examples / total number of examples) * 100) on the testing set for each k=1,3,5. You can use the following programming languages: Java. Your program will accept arguments in the following order: the name of the file containing the training set, the name of the file containing the testing set, and a value of k (e.g. java NearestNeighbor train.data test.data 1).
IN JAVA
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started