Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions