Aan de slagGa gratis aan de slag

Boosting for predicted revenue

The initial model got an RMSE of around 7.34. Let's see if we can improve this using an iteration of boosting.

You'll build another linear regression, but this time the target values are the errors from the base model, calculated as follows:

y_train_error = pred_train - y_train
y_test_error = pred_test - y_test

For this model you'll use 'popularity' feature instead, hoping that it can provide more informative patterns than with the 'budget' feature alone. This is available to you as X_train_pop and X_test_pop. As in the previous exercise, the input features have been standardized for you.

Deze oefening maakt deel uit van de cursus

Ensemble Methods in Python

Cursus bekijken

Oefeninstructies

  • Fit a linear regression model to the previous errors using X_train_pop and y_train_error.
  • Calculate the predicted errors on the test set, X_test_pop.
  • Calculate the RMSE, like in the previous exercise, using y_test_error and pred_error.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Fit a linear regression model to the previous errors
reg_error = LinearRegression()
____

# Calculate the predicted errors on the test set
pred_error = ____

# Evaluate the updated performance
rmse_error = ____
print('RMSE: {:.3f}'.format(rmse_error))
Code bewerken en uitvoeren