Need help for solving KNN with manhattan distance problem.
Budget: $10 – $30 USD
1. 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 Manhattan 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. Show your work. Show steps for reaching the answer.
(a) What is the leave-one-out cross-validation error of 1NN on this dataset?
(b) What are the 3 nearest neighbors for data points 3 and 10 respec- tively.
(c) What is the 3-folded cross-validation error of 3NN on this dataset? For the ith fold, the testing dataset is composed of all the data points whose (ID mod 3 = i − 1).
(d) Based on the results of (a) and (c), can we determine which is a better classifier, 1NN or 3NN? Why?
Write code in Python to perform the following tasks; if needed, you are allowed to use scipy, sklearn, and numpy packages. Show your work. Show steps for reaching the answer.
(a) What is the leave-one-out cross-validation error of 1NN on this dataset?
(b) What are the 3 nearest neighbors for data points 3 and 10 respec- tively.
(c) What is the 3-folded cross-validation error of 3NN on this dataset? For the ith fold, the testing dataset is composed of all the data points whose (ID mod 3 = i − 1).
(d) Based on the results of (a) and (c), can we determine which is a better classifier, 1NN or 3NN? Why?