Machine Learning Community Question

What is the best strategy for Hyperparameter Tuning in 2024?

Posted on 2024-02-10 • In Machine Learning • By Robert Taylor

I am working on a Gradient Boosting project using XGBoost and the number of parameters is overwhelming. I’ve been using GridSearch, but it takes forever to run. Is RandomSearch actually better, or should I invest time in learning Bayesian Optimization or tools like Optuna? I need a workflow that balances finding the optimal learning rate and tree depth without burning through my entire compute budget.

3 Answers 8,963 Views

All answers to this question 3 Answers

Jennifer Smith Answered on 2024-02-15
Answered

GridSearch is definitely outdated for complex models like XGBoost because it evaluates every single combination, many of which are useless. RandomSearch is statistically proven to find better results in less time because it explores the search space more broadly. However, for a professional workflow in 2024, Bayesian Optimization is the gold standard. It uses the results of previous iterations to "guess" where the next best parameters might be. Tools like Optuna are fantastic because they allow for "Pruning"—automatically stopping trials that show poor performance early on, which saves a massive amount of compute.

Michael Brown Answered on 2024-02-20
Answered

Since you are using XGBoost, have you considered using its built-in "cv" function with early stopping first to narrow down the number of boosting rounds before tuning other parameters?

Robert Taylor Commented on 2024-02-24
Commented

Michael, I haven't combined the "cv" function with my tuning script yet. That makes a lot of sense—it would let me fix the n_estimators based on the learning rate first. This would significantly reduce the dimensions of my search space. I was trying to tune everything at once, which is probably why it was so slow. I’ll try fixing the boosting rounds first and then use Optuna for the max_depth and subsample parameters.

Sarah Wilson Answered on 2024-03-02
Answered

Don't forget that sometimes the default parameters are surprisingly good. Only tune the parameters that actually impact the "Bias-Variance" tradeoff significantly for your specific data.

Jennifer Smith Commented on 2024-03-05
Commented

Totally agree with Sarah. Over-tuning can sometimes lead to a model that is too specific to your training set and performs poorly in production.

Write a Comment

Your email address will not be published. Required fields are marked (*)

Join the LearnersEra Community

Ask questions, share knowledge and learn from professionals across technology, project management and certification topics.

Change Country and Nearest City

Select your country and nearest city to see courses available in your region.