Question: Part III. Numerical prediction with K-nearest neighbors algorithm. In this part, we will predict FARE using all other variables. The KKNN package will be used.
Part III. Numerical prediction with K-nearest neighbors algorithm. In this part, we will predict FARE using all other variables. The KKNN package will be used. A script that demonstrates use of this package for numerical prediction is posted on the Canvas page for KNN. Since FARE has been scaled (and we need it unscaled), repeat the data processing steps at the beginning of assignment, except do not scale the variables. Convert SW, VACATION, GATE and SLOT into numerical dummy variables and partition the data set using the same seed. Build a KNN model to predict FARE using the kknn function. Use k=7, kernel = "rectangular", distance=2. Set the argument scale=TRUE (this will scale the predictors). What is the validation RMSE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
