Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 7 . 0 { points: 1 } Next, we'll use cross - validation on our training data to choose k . In k -

Question 7.0
{points: 1}
Next, we'll use cross-validation on our training data to choose k. In k-nn classification, we used accuracy to see how well our predictions matched the true labels.
In the context of k-nn regression, we will use RMSPE as the scoring instead. Interpreting the RMSPE value can be tricky but generally speaking, if the prediction
values are very close to the true values, the RMSPE will be small. Conversely, if the prediction values are not very close to the true values, the RMSPE will be quite
large.
Let's perform a cross-validation and choose the optimal k!
First, create a pipeline for k-nn. We are still using the k-nearest neighbours algorithm, and we will also use the StandardScaler to standardize the numerical
values. Store your pipeline in an object called marathon_pipe. Finally, perform a cross-validation with 5 folds using the cross_validate function. Remember
that since the cross_validate function always maximizes its "score", and here we're using RMSPE (lower is better!), we need to specify that we're using the
negative RMSPE ( "neg_root_mean_squared_error" ).
marathon_cv
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago