Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise: Simple kNN Regression The goal of this exercise is to re-create the plots given below. You would have come across these graphs in the

image text in transcribed

image text in transcribed

Exercise: Simple kNN Regression The goal of this exercise is to re-create the plots given below. You would have come across these graphs in the lecture as well. Instructions: Part 1: KNN by hand for k=1 - Read the Advertisement data. - Get a subset of the data from row 5 to row 13. - Apply the kNN algorithm by hand and plot the first graph as given above. Part 2: Using sklearri package - Read the Advertisement dataset. - Split the data into train and test sets using the train_test_split() function. - Set as the possible k values ranging from 1 to 70. - For each value of k in k_list: - Use sklearn to fit train data. - Predict on the test data. - Use the helper code to get the second plot above for k=1,10,70. Exercise: Simple kNN Regression The goal of this exercise is to re-create the plots given below. You would have come across these graphs in the lecture as well. Instructions: Part 1: KNN by hand for k=1 - Read the Advertisement data. - Get a subset of the data from row 5 to row 13. - Apply the kNN algorithm by hand and plot the first graph as given above. Part 2: Using sklearri package - Read the Advertisement dataset. - Split the data into train and test sets using the train_test_split() function. - Set as the possible k values ranging from 1 to 70. - For each value of k in k_list: - Use sklearn to fit train data. - Predict on the test data. - Use the helper code to get the second plot above for k=1,10,70

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions