Write a function to find the optimal k (the k value which minimizes the classification error) and call it optimal_k. In other words, at which value of k does the k_class_error take the minimum value?

ASSIGNMENT

Exercise #1: List the Nine_neighbors # your code here Nine_balance<-arrange(names, income)[

Exercise 2 Use knn function in class package and predict labels in the test data with knn when k=5. Use set.seed(4230) and name the p # Exercise #3: knn results when k=10 # your code here #

Exercise #4: Performance measure # your code here 0

Exercise 5: Write a function to find the optimal k (the k value which minimizes the classification error) and call it optimal_k. In other words, at which value of k does the k_class_error take the minimum value?

 

Write a function to find the optimal k (the k value which minimizes the classification error) and call it optimal_k. In other words, at which value of k does the k_class_error take the minimum value?
Scroll to top