Question: ( 8 marks ) In this question, you will fit kNN regression models to the Auto data set to predict Y = m p g

(8 marks) In this question, you will fit kNN regression models to the Auto data set to predict Y=mpg using x= horsepower. This data has been divided into training and testing sets: AutoTrain.csv and AutoTest.csv (download these sets from Learn). The )R function on Learn should be used to answer this question (you need to run the kNN code before calling the function).
(a) Perform kNN regression with k=2,5,10,20,30,50 and 100,(learning from the training data) and compute the training and testing MSE for each value of k.
(b) Which value of k performed best? Explain.
(c) Plot the training data, testing data and the best kNN model in the same figure. (The points () function is useful to plot the kNN model because it is discontinuous.)
(d) Describe the bias-variance trade-off for kNN regression.
 (8 marks) In this question, you will fit kNN regression models

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 Databases Questions!