Question: ( 1 ) ( 6 points ) Based on the training data, implement 5 - fold cross - validation ( CV ) to select the

(1)(6 points) Based on the training data, implement 5-fold cross-validation (CV) to select the best KNN model with the smallest CV error from different KNN mod- els under different K values, such as K =210,190,170,150,130,110,90,70,50,30,10,9,8,7,6,5,4,3,2and1. WhatistheoptiamlKfortheselected model? Based on the selected model, compute the confusion matrices and the mis-classification error rates for both the training data and test data, respectively. (Hint: please refer to sample code "cv-knn.R" in the same "Exams" sub-folder of CANVAS Files and certain level of customization is needed. "cv-knn.R" im- plements slide 13 of lecture 10. In your problem, set your random seed as 2024 when you (i) split training data into 5 folds, and (ii) make predictions using KNN 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 Programming Questions!