intermediateadvanced-ml

Hyperparameter Tuning

The dials a model can't learn on its own — you have to search for the right settings.

Key Points

What it is

Hyperparameters are settings chosen before training (like tree depth, learning rate, or number of clusters) rather than learned from the data itself. Hyperparameter tuning is the systematic process of searching for the combination of these settings that gives the best model performance.

Why it exists

The same algorithm can perform very differently depending on its settings — a decision tree with max_depth=3 barely learns anything, while max_depth=50 memorizes the training data. Hyperparameter tuning exists because there's no formula that hands you the right settings in advance; they have to be searched for empirically.

Intuition

Think of baking the same cake recipe at different oven temperatures and times. The ingredients (data) and technique (algorithm) are fixed, but temperature and time (hyperparameters) drastically change the outcome. You can't calculate the perfect combination in advance — you have to run a series of test bakes and see which one comes out best.

When to use

When not to use

Common mistakes

In practice

A standard step in every serious modeling pipeline — done via tools like GridSearchCV, RandomizedSearchCV, or Optuna, typically wrapped around cross-validation to reliably estimate which settings generalize best.

Was this concept helpful?

Spot an error or gap? Suggest an edit →

Related concepts

cross-validationgradient-boostingrandom-forest
Chirp at me!