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 Rsquared metrics.
Exercise :
Using your olsmodel, sgdmodel, and ridgemodel make predictions using your Xtest data and save these predictions as olspred, sgdpred, and ridgepred respectively.
Find the RMSE for each model using ScikitLearn's meansquarederror function passing it your ytest and predictions from step above. Round these RMSE scores to decimal places. Save these scores as rmseols, rmsesgd and rmseridge respectively. Hint: Remember that we are asking for RMSE and not MSE. Check ScikitLearn's documentation for how to calculate the RMSE value.
Find the Rsquared values for each model using ScikitLearn's rscore function passing it your ytest and predictions from step above. Round these Rsquared scores to decimal places. Save these scores as rols, rsgd and rridge respectively.
Print the MSE and Rsquared scores for each model.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
