1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Linear Modeling in Python

Exercise

RMSE Step-by-step

In this exercise, you will quantify the over-all model "goodness-of-fit" of a pre-built model, by computing one of the most common quantitative measures of model quality, the RMSE, step-by-step.

Start with the pre-loaded data x_data and y_data, and use it with a predefined modeling function model_fit_and_predict().

Instructions

100 XP
  • Compute y_model values from model_fit_and_predict(x_data, y_data).
  • Compute the residuals as the difference between y_model and y_data.
  • Use np.sum() and np.square() to compute RSS, and divide by len(residuals) to get MSE.
  • Take the np.sqrt() of MSE to get RMSE, and print all results.