Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

KNN Assignment:

Build a very straightforward and fully functional machine learning classifier with the K-Nearest Neighbor (KNN) algorithm. The KNN model will read a set of data specified by the user, decide the appropriate class of the new instance, and finally output the performance metrics of the model based on test data set.

Requirements:

  • The implementation should  be written in Java.
  • The distance metric used  should be Euclidean distance.
  • The model should use the  training data set as the existing data set to classify the data in the  test set.
  • The performance metrics  output needs to include the confusion matrix and accuracy  (1-misclassification rate).
  • The code must be commented  so that each implemented component of the KNN algorithm is properly  labeled.
  • Use object-orien ted techniques (do not make the whole program one monolithic procedu ral implementation).
    • Separate the distance  calculations, sorting, data structure, and other components so that each  of them can be developed and reviewed individually.
  • Implement the classifier  as a standalone program.

Assignment Deliverable:

This is what I need for my output

1) All source code

2) A copy of the output when K=3

3) A copy of the output when K=5

4) A copy of the output when K=7

5) Confusion matrix and accuracy

A few notes:

- Input/output streams

- Distance calculation

- KNN algorithm

- Confusion matrix and accuracy

- Object-oriented and commented codes

2) You must take the input file path from the command line. We want students to learn how to input dataset from file into memory. In the real world, we will run multiple datasets via multiple files to analyze the results. Coding the file name in your program is not practical.

3) Make sure you test all the rows and use all the other data points as your training data. For example, when you are testing row 1, you need to use rows 2 to 150 as the training data for the calculation. When you are testing row 2, you need to use rows 1 and rows 3 to 150 for the calculation.

4) You should not use a K with an even number. After locating the K nearest neighbors, we need to take the majority for the predicted value. An even number K will potentially have many ties when you are trying to select the majority.

5) I may choose to run a subset of the input data. Please make sure your program works for any input data with the same format.

Java, Programming

  • Category:- Java
  • Reference No.:- M91232091

Have any Question?


Related Questions in Java

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As