asadoughi / stat-learning

Notes and exercise attempts for "An Introduction to Statistical Learning"
http://asadoughi.github.io/stat-learning
2.12k stars 1.62k forks source link

Chapter 4 Exercise 11 #87

Open kovacu opened 6 years ago

kovacu commented 6 years ago

Point (g): The selected train data (train = (year%%2 == 0) ) leads to optimal KNN solution with k = 3. Test error in this case amounts to 13.7 %. #######

knn.pred = knn(train.X, test.X, train.mpg01, k = 3) mean(knn.pred != mpg01.test) [1] 0.1373626 #######