Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!