Question: Let's now see how the three models compare using the root mean squared error ( RMSE ) and R - squared metrics. Exercise 7 :

Let's now see how the three models compare using the root mean squared error (RMSE) and R-squared metrics.
Exercise 7:
Using your ols_model, sgd_model, and ridge_model make predictions using your X_test data and save these predictions as ols_pred, sgd_pred, and ridge_pred respectively.
Find the RMSE for each model using Scikit-Learn's mean_squared_error function passing it your y_test and predictions from step 1 above. Round these RMSE scores to 4 decimal places. Save these scores as rmse_ols, rmse_sgd, and rmse_ridge respectively. Hint: Remember that we are asking for RMSE and not MSE. Check Scikit-Learn's documentation for how to calculate the RMSE value.
Find the R-squared values for each model using Scikit-Learn's r2_score function passing it your y_test and predictions from step 1 above. Round these R-squared scores to 4 decimal places. Save these scores as r2_ols, r2_sgd, and r2_ridge respectively.
Print the MSE and R-squared scores for each model.

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 Programming Questions!