Bringing it all together
Alright, it's time to bring together everything you've learned so far! In this final exercise of the course, you will combine your work from the previous exercises into one end-to-end XGBoost pipeline to really cement your understanding of preprocessing and pipelines in XGBoost.
Your work from the previous 3 exercises, where you preprocessed the data and set up your pipeline, has been pre-loaded. Your job is to perform a randomized search and identify the best hyperparameters.
Diese Übung ist Teil des Kurses
Extreme Gradient Boosting with XGBoost
Anleitung zur Übung
- Set up the parameter grid to tune
'clf__learning_rate'
(from0.05
to1
in increments of0.05
),'clf__max_depth'
(from3
to10
in increments of1
), and'clf__n_estimators'
(from50
to200
in increments of50
). - Using your
pipeline
as the estimator, perform 2-foldRandomizedSearchCV
with ann_iter
of2
. Use"roc_auc"
as the metric, and setverbose
to1
so the output is more detailed. Store the result inrandomized_roc_auc
. - Fit
randomized_roc_auc
toX
andy
. - Compute the best score and best estimator of
randomized_roc_auc
.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Create the parameter grid
gbm_param_grid = {
'____': ____(____, ____, ____),
'____': ____(____, ____, ____),
'____': ____(____, ____, ____)
}
# Perform RandomizedSearchCV
randomized_roc_auc = ____
# Fit the estimator
____
# Compute metrics
print(____)
print(____)