1. Learn
  2. /
  3. Courses
  4. /
  5. Machine Learning with Tree-Based Models in Python

Exercise

Linear regression vs regression tree

In this exercise, you'll compare the test set RMSE of dt to that achieved by a linear regression model. We have already instantiated a linear regression model lr and trained it on the same dataset as dt.

The features matrix X_test, the array of labels y_test, the trained linear regression model lr, mean_squared_error function which was imported under the alias MSE and rmse_dt from the previous exercise are available in your workspace.

Instructions

100 XP
  • Predict test set labels using the linear regression model (lr) and assign the result to y_pred_lr.

  • Compute the test set MSE and assign the result to mse_lr.

  • Compute the test set RMSE and assign the result to rmse_lr.