Gradient Boosting is another powerful boosting algorithm. Here is the sklearn documentation of Gradient Boosting.
To train we run
1 2 | |
and generate predictions as usual as
1 2 | |
Early stopping is one of the important methods we use to prevent over-fitting. Below is the example code of how we perform Gradient Boosting with early stopping.
1 2 | |
Find the optimal n_estimators - have lowest error on validation set
1 2 3 4 5 6 | |
1 2 | |
Since the number of estimators we tried here is only 10, it does not satisfy the requirement of early stopping. However, you can try a larger value for n_estimators to see the impact of early stopping here.
1 2 3 4 5 6 7 8 9 10 11 | |
Question
Tune the hyper-parameter of Gradient Boost. Try your best to optimize the model performance.