How to Choose the Right Hyperparameter Search


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!


My new focused machine learning courses are now on Udemy

I know many of you already use—and love—Udemy, so I’m back with a new series of short, focused courses designed to help you learn one valuable machine learning skill at a time.

Choose the topic most relevant to you, or explore my full course collection. I hope to see you in one of the courses!


How to Choose the Right Hyperparameter Search

Every machine learning model comes with settings that shape how it learns. A random forest has a number of trees and a maximum depth. A gradient boosting model has a learning rate and a number of boosting rounds. We call these settings hyperparameters.

Hyperparameter optimisation is the process of trying different values and selecting the combination that performs best on validation data.

Most people use grid search or random search. If you have used Hyperopt or Optuna, you probably also heard of TPE. So which method should you use, why, and when?

Here are practical guidelines for choosing a strategy that fits your model, your search space, and your computing budget.

The two methods you will use most often

Grid search tries every combination from a list of values. Imagine tuning the depth of a decision tree with the values 3, 5, and 10, and the minimum number of samples per leaf with the values 5 and 20. Grid search trains all six combinations.

This works beautifully when you have one or two hyperparameters and only a few sensible values. Linear models, logistic regression, and K nearest neighbours often fit this situation.

Random search samples combinations from ranges or lists. Give it a budget of 30 trials and it explores 30 combinations of hyperparameters. The advantage over grid search is that ti samples from hyperparameter distributions instead of manually picked values.

Random search helps when several hyperparameters matter or when values such as the learning rate come from a continuous range.

Random search is a strong default for random forests, Extra Trees, gradient boosting, XGBoost, and CatBoost. It explores broad spaces efficiently and runs many trials in parallel.

Make grid and random search faster with multi-fidelity

Grid and random search give every configuration the full training budget. That means, for every hyperparameter combination, they train the model till the end.

Multi-fidelity methods begin with a small budget and increase it for the most promising hyperparameter combinations.

Successive Halving, for example, trains every combination on a small sample of the data or for a few boosting rounds. It keeps the most promising groups, gives them more resources, and repeats the process till it finds the winning configuration.

This approach is especially useful when models train for many epochs, use hundreds of boosting rounds, or work with a large dataset. You still choose configurations with grid or random search. Successive Halving decides how much training time each configuration receives.

By stopping unpromising configurations early, it saves a lot of computing time, accelerating the search substantially. If you are not using successive halving, you are probably wasting a lot of time 😊

Where TPE enters the picture

TPE stands for Tree structured Parzen Estimator. It is an adaptive search method. Instead of choosing hyperparameter values at random, it chooses them from more promising areas.

TPE separates previous trials into a stronger group and a weaker group. It then looks for parameter values that appear frequently in the stronger group and less frequently in the weaker one. As more results arrive, its suggestions become more informed.

TPE is useful when each trial takes meaningful time or the search space contains many parameters. By selecting hyperparameters that are promising, with less trials, so the theory goes, it can find better values.

In my personal opinion, TPE became popular before the multi-fidelity models were described. For tabular data, I’d recommend you stick to random search and make it faster with successive halving.

So, which method should you choose?

👉 Choose grid search when you have one or two hyperparameters, a small set of candidate values, and quick model fits.

👉 Choose random search for more complex scikit-learn models or the sklearn compatible versions of XGBoost or lightGBM.

👉 Use Successive Halving to make random search faster, particularly for tree based ensemble methods.

👉 Choose TPE when trials are costly, the space is large, or the parameters follow conditional rules. Its learning process can find strong regions with fewer trials.

If you liked this article, you’ll also enjoy my recently updated course: Master Hyperparameter Tuning for Tabular Learning.​

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
Job descriptions rarely tell the whole story

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! New set of focused ML interpretability courses now on Udemy I know many of you already use Udemy, so this October I released a new series of short, focused courses designed to help you learn one valuable machine learning skill at a time The Complete SHAP and Shapley Values Masterclass Interpretable Machine Learning:...

AI-generated pull requests won't land you that data science job

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! Three proof copies of my books looking for a new home While I was working on making the physical copies of my books available through different providers, I ended up with three proof copies. They are not perfect: one has the "not for sale" band, and one of the feature selection copies has a few typos here and there....

Why optimise for calibration if I can recalibrate later?

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! Machine Learning Interpretability course has been updated! I’ve recently finished updating my Machine Learning Interpretability course. 🎉 I’ve refreshed the course notebooks, replacing outdated libraries with practical alternatives and adding fixes to keep examples running as Python evolves. You’ll explore the same...