Solve this using R and R studio Use the Boston data set from the MASS package to answer the below questions. 1. Using createDataPartition() function from the Caret package to partition the data into two parts – 80% into training data and 20% into test data. 2. Using train() function from the Caret package, run a k-NN model with medv as the response or target variable with the following: a. Standardize the dataset using center and scale options in the preProcess() function in the Caret package b. Use a 10-fold cross validation 3. Generate a plot showing model error RMSE against different values of k. 4. What is the optimal value of k? Explain how you chose this value.
Solve this using R and R studio
Use the Boston data set from the MASS package to answer the below questions.
1. Using createDataPartition() function from the Caret package to partition the data into two parts – 80% into training data and 20% into test data.
2. Using train() function from the Caret package, run a k-NN model with medv as the response or target variable with the following:
a. Standardize the dataset using center and scale options in the preProcess() function in the Caret package
b. Use a 10-fold cross validation
3. Generate a plot showing model error RMSE against different values of k.
4. What is the optimal value of k? Explain how you chose this value.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images