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.
Este ejercicio forma parte del curso
Ensemble Methods in Python
Instrucciones del ejercicio
- 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.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# 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))