Back to Evaluation, Leakage, and Unsupervised

Hyperparameter Tuning — Grid, Random, Bayesian

Three strategies: brute force, random, smart. When each is right and where Optuna fits. FIND_VIDEO: search 'hyperparameter tuning bayesian optimization' — recommended channel: StatQuest / sklearn docs. Aim for 10 min or under.

20 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.

Ready to continue?

Mark this lesson as complete when you're ready to proceed.

Key moments

  1. Objective Function DefinitionMinimizing an objective function is the fundamental goal of hyperparameter tuning.
  2. Grid Search IntuitionGrid search checks every parameter combination exhaustively to find the minimum objective value.
  3. ML Search SpaceHyperparameters define a combinatorial search space, illustrated by 36 combinations for a decision tree.
  4. Grid Search ImplementationCode demonstrates iterating through all 998 combinations to find the minimum value of y.
  5. Random Search ConceptRandom search samples a fixed, smaller number of combinations to quickly find a near-optimal result.
  6. Bayesian Search ModelBayesian search uses a cheap surrogate function to approximate the expensive, unknown true objective function.
  7. Utility Function RoleThe utility function guides the search by balancing exploration of new regions and exploitation of known good areas.
  8. Bayesian Search ResultsBayesian search finds a near-optimal result with significantly fewer iterations than exhaustive Grid Search.
PDF notes

Frequently asked questions

Why is minimizing negative AUC the same as maximizing AUC?

Optimization algorithms typically seek to minimize a function (loss). By minimizing the negative of a score (like AUC), you achieve the goal of maximizing the original score.

What is the total search space for the decision tree example?

The total search space is the product of the number of options for each hyperparameter: 3 x 2 x 2 x 3 = 36 possible combinations.

What does "exploit the current knowledge" mean in Bayesian search?

It means sampling points near the current best-observed result, assuming that nearby points are likely to also be good.

Why do we need a surrogate function in Bayesian Optimization?

Evaluating the true objective function (training and testing the ML model) is computationally expensive. The surrogate function provides a cheap approximation to guide the search efficiently.