(12) – Finding the Needle in the High-Dimensional Haystack: Bayesian Optimization

Olivier Krieger
26.03.2026 · 3 min read

Mastering the art of exploration vs. exploitation to tune the perfect model.

This week, I reached a milestone in my Machine Learning Professional Certificate: Module 12: Bayesian Optimization. This topic is so fundamental to modern AI that it serves as the core of our upcoming capstone project.

Bayesian Optimization is the “meta” of machine learning—it is the process of using machine learning to optimize other machine learning models. It is specifically designed for “black-box” functions that are incredibly expensive, slow, or risky to evaluate.

Here are the key concepts from this advanced deep dive:

1. Parameters vs. Hyperparameters

First, we cleared up a classical point of confusion.

  • Parameters: These are the internal variables the model learns on its own from the training data, like the coefficients in a linear regression or the split points in a decision tree.
  • Hyperparameters: These are the external “knobs” that we (the data scientists) must turn before training begins. Examples include the learning rate, the number of trees in a forest, or the maximum depth of a tree. Bayesian Optimization is the tool we use to find the perfect setting for these knobs.

2. The Gaussian Process (The Surrogate Model)

Since we can’t afford to test every possible combination of hyperparameters, we build a Surrogate Model—essentially a “model of our model”. We typically use Gaussian Processes (GP) for this. A GP doesn’t just give us a predicted value; it provides a probability distribution that includes a mean (our best guess) and a variance (our level of uncertainty).

3. Exploration vs. Exploitation

This is the heart of the optimization strategy. Every time we choose a new set of hyperparameters to test, we face a choice:

  • Exploitation: Testing a region where the surrogate model predicts a high reward (going where we think the “peak” is).
  • Exploration: Testing a region where the uncertainty is high (going where we haven’t looked yet).

4. Acquisition Functions: The Decision Maker

To balance that trade-off, we use an Acquisition Function to tell us exactly where to sample next. I learned about three primary types:

  • Maximum Variance: Pure exploration. It guides the optimizer to sample exactly where the model is most uncertain.
  • Probability of Improvement (PI): Pure exploitation. it looks for the point most likely to beat our current best result.
  • PI with Exploration Term (ξ): A balanced approach that forces the optimizer to seek points that outperform the current best by a significant margin.

5. Why it Beats Grid Search

In the past, we used “Grid Search” (testing every single point) or “Random Search.” Bayesian Optimization is far superior because it is sequential. It uses the results of every past experiment to inform the next one, allowing it to converge on the optimal settings much faster and with fewer expensive trials.

Conclusion

Module 12 took me from “guessing” the right settings to using a rigorous, probabilistic framework to find them. Whether it’s tuning a walking robot to keep it from falling or finding the best learning rate for a neural network, Bayesian Optimization is the gold standard for efficient discovery.