Which hyperparameters should you tune?


Welcome!

Every Monday, I’ll drop a no-fluff, straight-to-the-point tip on a data science skill, tool, or
method to help you stay sharp in the field. I hope you find it useful!


Which hyperparameters should you tune?

Anyone who opens the XGBoost documentation for the first time finds a long list of hyperparameters, from the learning rate and the depth of the trees to regularisation terms, sampling ratios and a few options whose purpose is far from obvious.

Faced with that list, it is hard to know where to start.

Most people deal with it in one of two ways. Some put every hyperparameter they can find into one huge search and leave it running for hours, while others copy the search space from a blog post or a Kaggle notebook and hope it suits their data.

Both approaches are understandable, especially when we are just starting out. But the first one burns a lot of computing time, and the second one leaves us with a model tuned for somebody else's problem.

Only a few hyperparameters matter

The good news is that research has shown that only a handful of hyperparameters drive most of the performance. In their classic paper on random search, Bergstra and Bengio suggested that searches over many hyperparameters succeed because most of them barely affect the result.

Van Rijn and Hutter studied hyperparameter importance across 100 datasets and found that, for random forests and AdaBoost, the same hyperparameters tend to stay the most important across datasets, and that focusing the search on them gives better results.

Probst, Boulesteix and Bischl benchmarked six popular algorithms on 38 datasets to measure the tunability of their hyperparameters, precisely to help practitioners decide which ones are worth tuning, and whether tuning is worth the time at all.

This means we can run smaller, faster searches and still find very good models. If you'd like to see how, I cover search spaces and search strategies in detail in my course Master Hyperparameter Tuning for Tabular Learning.

The hyperparameters that matter for tree ensembles

For gradient boosting machines like XGBoost and LightGBM, these are the hyperparameters worth starting with:

  • Learning rate and number of trees. These two work together, because a smaller learning rate needs more trees to reach the same performance. A common approach is to fix a small learning rate and let early stopping find the number of trees.
  • Tree complexity. The maximum depth in XGBoost, or the number of leaves in LightGBM, together with the minimum number of observations per leaf, controls how much each tree can learn, and it is our main defence against overfitting.

Random forests are much more forgiving, and they often perform well with their default values. When we do tune them, these are the ones that matter most:

  • max_features, the number of features considered at each split, which is usually the most influential.
  • min_samples_leaf or max_depth, which control how deep and specific each tree becomes.
  • max_samples, the fraction of observations used to build each tree, which can help with large datasets.

The number of trees behaves differently from the rest, because adding trees tends to improve performance until it plateaus. So it is better treated as a computing budget than as something to tune.

Why each of these hyperparameters matters, and how they shape the trees and the final model, is exactly what we cover in our coming course, Master Tree Ensemble Models: From Decision Trees to Gradient Boosting, which we'll launch in November.

To wrap up

Tuning becomes much easier once we know which few hyperparameters deserve our attention, because our searches get smaller, faster and easier to interpret. If you'd like to learn how to define search spaces, choose the right search strategy and evaluate the results with confidence, join me in Master Hyperparameter Tuning for Tabular Learning. I look forward to seeing you there.

I hope this information was useful!

Wishing you a successful week ahead - see you next Monday! πŸ‘‹πŸ»

Sole


Ready to enhance your skills?

Our courses and books are here to assist you:


Hi…I’m Sole
​
I’m a Python developer, AI educator, and developer advocate. I’m the creator and maintainer of Feature-engine and the main instructor at Train in Data.
​
I share practical Python lessons, open-source insights, and ideas to help our community build better software and grow as developers and data scientists.

You are receiving this email because you subscribed to our newsletter, signed up on our website, purchased or downloaded any products from us.


Follow us on social media

Copyright (C) 2026 Train in Data. All rights reserved.

​
​Unsubscribe Β· Preferences​

Train in Data

by Soledad Galli, PhD | Data scientist | Python Developer | Best-selling instructor | Book author | πŸ‘‰ www.trainindata.com

Read more from Train in Data
Your hyperparameter search is probably bigger than it needs to be

Welcome! Every Monday, I’ll drop a no-fluff, straight-to-the-point tip on a data science skill, tool, ormethod to help you stay sharp in the field. I hope you find it useful! Something exciting is coming this Black Friday! πŸ‘€ November is here, and that means Black Friday is just around the corner! Have you had your eye on one of our courses for a while, or been waiting for the right moment to get started? Well, we have something coming up that you might want to look out for! We're preparing...

After months with Claude and ChatGPT, here is where each one wins

Welcome! Every Monday, I’ll drop a no-fluff, straight-to-the-point tip on a data science skill, tool, ormethod to help you stay sharp in the field. I hope you find it useful! Our new course is out! Master Tree Ensemble Models: from Decision Trees to Gradient Boosting! XGBoost, LightGBM, and CatBoost are everywhere, and generative AI can now set them up in minutes. But can you explain what they are doing, why they make certain decisions, or whether the generated configuration makes sense?...

Grid or random search? You might be using the wrong one

Welcome! Every Monday, I’ll drop a no-fluff, straight-to-the-point tip on a data science skill, tool, ormethod to help you stay sharp in the field. I hope you find it useful! Coming soon: Master Tree Ensemble Models. From Decision Trees to Gradient Boosting! We’re developing a comprehensive new course on the models that dominate machine learning for tabular data, starting with decision trees and progressing through powerful ensemble methods. The main focus will be on the all-time favourites:...