How does Bayesian hyperparameter optimization work at a high level?
hardAnswer
- Maintain a surrogate model of the objective (usually a Gaussian process or Tree-structured Parzen Estimator) as a function of hyperparameters.
- At each iteration: (1) predict the objective's mean and uncertainty across the search space; (2) use an acquisition function (Expected Improvement, UCB, or TPE-specific rules) to pick the next config — balancing exploration of uncertain regions and exploitation of promising ones; (3) run that config, update the surrogate.
- Beats random/grid because it *learns* from past trials.
- Best tools today: Optuna, scikit-optimize, Ax.
Check yourself — multiple choice
- It's the same as random search
- A surrogate model predicts the objective; an acquisition function picks the next config, balancing exploration and exploitation
- It requires gradient computations of the metric
- It only works for neural nets
Bayesian opt: surrogate model + acquisition function to smartly pick the next trial.
#hyperparameter-tuning
Practise Supervised Learning
215 interview questions in this topic.
Related questions
- How do you choose the regularization strength (lambda / alpha)?
- How do you choose k in k-Nearest Neighbours?
- What are the most impactful hyperparameters of a decision tree?
- Which Random Forest hyperparameters actually matter for tuning?
- What is the role of the learning rate (shrinkage) in GBM?
- Which XGBoost hyperparameters have the biggest impact, and in what tuning order?