Exercise

Tuning eta

It's time to practice tuning other XGBoost hyperparameters in earnest and observing their effect on model performance! You'll begin by tuning the "eta", also known as the learning rate.

The learning rate in XGBoost is a parameter that can range between 0 and 1, with higher values of "eta" penalizing feature weights more strongly, causing much stronger regularization.

Instructions

100 XP
  • Create a list called eta_vals to store the following "eta" values: 0.001, 0.01, and 0.1.
  • Iterate over your eta_vals list using a for loop.
  • In each iteration of the for loop, set the "eta" key of params to be equal to curr_val. Then, perform 3-fold cross-validation with early stopping (5 rounds), 10 boosting rounds, a metric of "rmse", and a seed of 123. Ensure the output is a DataFrame.
  • Append the final round RMSE to the best_rmse list.