讓 AdaBoost 發揮最大效益
如你所見,在電影營收預測上,當以決策樹作為基學習器時,AdaBoost 會得到最好的結果。
在這個練習中,你將設定一些參數以榨出更多效能。特別是,你會使用較低的學習率,讓超參數的更新更為平滑。因此,估計器的數量應該要增加。此外,資料中也新增了以下特徵:'runtime'、'vote_average' 和 'vote_count'。
本練習屬於課程
Python 的 Ensemble 方法
練習說明
- 使用
100個估計器與0.01的學習率建立AdaBoostRegressor。 - 將
reg_ada擬合到訓練集,並在測試集上計算預測結果。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# 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))