ComeçarComece de graça

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 exercício faz parte do curso

Ensemble Methods in Python

Ver curso

Instruções do exercício

  • Instantiate the default linear regression model.
  • Build and fit an AdaBoostRegressor, using the linear regression as the base model and 12 estimators.
  • Calculate the predictions on the test set.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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))
Editar e executar o código