Question: [ K N N + C V ] l o n g r i g h t a r r o w Considering the dataset

[KNN+CV]longrightarrow Considering the dataset with two real-valued inputs x1 and x2 and one binary output y in the table below. Each data point will be referred using the first column "ID" in the following. You will use KNN with Euclidean distance to predict y.
Write code in Python to perform the following tasks; if needed, you are allowed to use scipy, sklearn, and numpy packages. Please submit one code file via the NCSU GitHub repository you have been given. Show your work. Show steps for reaching the answer.
\table[[ID,x 1,x 2,y],[1,-3.44,1.0,**],[2,-6.48,5.0,**],[3,0.93,-2.0,**],[4,0.2,2.0,**],[5,-6.69,13.0,**],[6,-5.85,4.0,**],[7,3.0,0.0,**],[8,-0.36,0.0,**],[9,1.68,-3.0,**],[10,-0.45,-3.0,**]]
(a)(4 points) What is the leave-one-out cross-validation error of 1 NN on this dataset?
(b)(2 points) What are the 3 nearest neighbors for data points 2 and 8 respectively.
(c)(5 points) What is the 3-folded cross-validation error of 3NN on this dataset? For the i th fold, the testing dataset is composed of all the data points whose (ID mod 3=i-1.
(d)(5 points) Based on the results of (a) and (c), can we determine which is a better classifier, 1NN or 3NN? Why? (Answers without a correct justification will get zero points.)
[ K N N + C V ] l o n g r i g h t a r r o w

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!