Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the Boston house price data set in sklearn, we are going to compare the performance of linear regression, ridge, and lasso. The variables can

Using the Boston house price data set in sklearn, we are going to compare the performance of linear regression, ridge, and lasso. The variables can be accessed by boston.data. Response variable is in: boston.target. The data sets have 506 observations and 13 predictors. Divide the data set randomly into 3 equal parts for training, validating, and testing. You can use function train_test_split. Each part will have roughly 160 observations. Build a linear regression model using the training data. Report estimated coefficients, their standard error, and statistical significance of each predictors. Perform ridge regression on the training data on a grid of 40 values of tuning parameters. Choose the values of so they are equidistant on the log-scale, ranging from a small value to a large one. For each value of, compute the score on the validating set. Plot the score on validating set vs. value of lamda. Report the value of that gives the best score on validating set. Perform lasso regression on the training data on a grid of 40 values of tuning parameters. Choose the values of so they are equidistant on the log-scale, ranging from a small value to a large one similar to the previous part. For each value of, compute the score on the validating set. Plot the score on validating set vs. value of lamda. Report the value of that gives the best score on validating set. Compare the score of three methods linear regression, ridge regression, and lasso regression with optimal choice of tuning parameters that you obtain from previous part. Draw conclusion on which predictors are chosen by each method.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions