Exercise

Measure model fit

Now you will measure the regression performance on both training and testing data with two metrics - root mean squared error and mean absolute error. This is a critical step where you are measuring how "close" are the model predictions compared to actual values.

The numpy library has been loaded as np. The mean_absolute_error and mean_squared_error functions have been loaded. The training and testing target variables are loaded as train_Y and test_Y, and the predicted training and testing values are imported as train_pred_Y and test_pred_Y respectively.

Instructions

100 XP
  • Calculate the root mean squared error on the training data by using the np.sqrt() function.
  • Calculate the mean absolute error on the training data.
  • Calculate the root mean squared error on the testing data.
  • Calculate the mean absolute error on the testing data.