Your first AdaBoost model
In the previous lesson you built models to predict the log-revenue of movies. You started with a simple linear regression and got an RMSE of 7.34
. Then, you tried to improve it with an iteration of boosting, getting to a lower RMSE of 7.28
.
In this exercise, you'll build your first AdaBoost model - an AdaBoostRegressor - in an attempt to improve performance even further.
The movies
dataset has been loaded and split into train and test sets. Here you'll be using the 'budget'
and 'popularity'
features, which were already standardized for you using StandardScaler()
from sklearn.preprocessing
module.
This exercise is part of the course
Ensemble Methods in Python
Exercise instructions
- Instantiate the default linear regression model.
- Build and fit an
AdaBoostRegressor
, using the linear regression as the base model and12
estimators. - Calculate the predictions on the test set.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Instantiate the default linear regression model
reg_lm = ____
# Build and fit an AdaBoost regressor
reg_ada = ____(____, ____, random_state=500)
reg_ada.fit(X_train, y_train)
# Calculate the predictions on the test set
pred = ____
# Evaluate the performance using the RMSE
rmse = np.sqrt(mean_squared_error(y_test, pred))
print('RMSE: {:.3f}'.format(rmse))