Decisions & optimisation

Bayesian optimisation: which experiment comes next?

Which setting should you test next when each evaluation costs time or money? A small experiment shows how a Gaussian process combines existing observations with targeted exploration.

  • 4 min read
  • Updated on
  • smartlytics editorial team

The short answer

Bayesian optimisation chooses new experiments using a probabilistic surrogate model. An acquisition function combines potential improvement with uncertainty so that expensive evaluations can be used selectively.

Explore the interactive exampleFree · in your browser · no sign-up

At a glance

  1. A Gaussian process provides a mean and model-dependent uncertainty for untested settings.
  2. Expected improvement evaluates possible gains over the best observed value.
  3. Results depend on model assumptions and the search space; a few good experiments do not prove global optimality.

A setting can be assessed only through an expensive evaluation: perhaps a simulated process temperature or a learning algorithm’s parameter. Hundreds of grid points are possible but costly. Which next experiment offers the most useful opportunity? Bayesian optimisation approaches the question through a model of the unknown objective function.

A model instead of a complete map

After a few evaluations, the known data consists of points (xi,yi)(x_i,y_i). A Gaussian process describes possible functions compatible with those observations. At an untested setting, it provides a posterior mean μ(x)\mu(x) and standard deviation σ(x)\sigma(x). Observed points influence their neighbourhood; the kernel’s length scale helps determine how far that influence extends.

The tool uses a one-dimensional search space from 0 to 1, a zero-mean Gaussian process and an RBF kernel:

k(x,x′)=exp⁡(−(x−x′)22ℓ2).k(x,x')=\exp\left(-\frac{(x-x')^2}{2\ell^2}\right).

The length scale ℓ\ell expresses assumed smoothness. A small value permits rapid variation; a large value connects distant settings more strongly. A Cholesky decomposition solves the covariance system, with a small diagonal addition for numerical stability. This is an actual updated model, not a sequence of predefined curves.

Choosing the next experiment

Selecting only the highest predicted mean could overlook uncertain regions. Selecting only the greatest uncertainty could waste evaluations on unattractive regions. Expected improvement combines the two considerations. For maximisation with best observed value f∗f^*, the acquisition function is

EI(x)=E[max⁡(f(x)−f∗−ξ,0)].\mathrm{EI}(x)=\E[\max(f(x)-f^*-\xi,0)].

For a normal predictive distribution, it has a closed form. Writing z=(μ−f∗−ξ)/σz=(\mu-f^*-\xi)/\sigma gives

EI=(μ−f∗−ξ)Φ(z)+σϕ(z).\mathrm{EI}=(\mu-f^*-\xi)\Phi(z)+\sigma\phi(z).

Φ\Phi and ϕ\phi are the standard normal cumulative distribution and density. The additional ξ\xi sets an improvement hurdle and can encourage more exploratory behaviour. The classic EGO paper uses expected improvement for expensive black-box functions (Jones 1998).

A fully specified learning example

To operate without external systems, the demonstration evaluates a synthetic objective:

f(x)=0.55sin⁡(10x)+0.35cos⁡(4x)+0.6x.f(x)=0.55\sin(10x)+0.35\cos(4x)+0.6x.

Initially, the optimiser receives only its values at 0.1, 0.5 and 0.9: approximately 0.845, −0.373 and 0.453. Although the demonstration code knows the function, the suggestion step does not evaluate it everywhere. Selection uses only observations already collected and the GP model. Clicking the button then measures the suggested point.

With default length scale 0.18 and ξ=0.01\xi=0.01, the first suggestion is x=0x=0. Its measured value is 0.35. The first additional experiment therefore does not improve the record. This is not an error: an informative experiment can help later search without itself being the best setting.

Interactive

Interactive: Bayesian optimisation: which experiment comes next?

Start with three observations. Each click calculates expected improvement, evaluates a new suggestion and updates the Gaussian process.

Reading the chart

The solid line is the GP mean. Dashed lines show μ±1.96σ\mu\pm1.96\sigma as pointwise model intervals, not a simultaneous guarantee covering the entire function. Points mark actual evaluations of the synthetic objective; the table records every attempt.

The acquisition function is evaluated at 201 evenly spaced candidates. Previously measured points are excluded, and the remaining candidate with the largest EI becomes the suggestion. Suggestion search is therefore itself approximate: a better setting between grid points could be missed.

Assumptions, budget and limits

The demonstration has one parameter and deterministic, noiseless evaluations. It does not fit kernel parameters automatically and stops after at most 20 attempts. Real measurements can be noisy, slow or invalid. Constraints and safe limits must be specified before a real experiment. Uncertainty alone is not a reason to try an unsafe setting.

Snoek and colleagues examine the practical relevance of model assumptions and evaluation costs (Snoek 2012). “Bayesian” does not guarantee an advantage for every problem. A simple grid or random search using the same evaluation budget remains a useful reference.

Defining your own application

Record the objective, admissible parameter ranges, cost per evaluation and stopping rule. Check whether the objective is stable enough and whether similar settings can reasonably be expected to produce similar results. For known algebraic constraints, mathematical optimisation may be more appropriate. To decide whether more information is worth its price, consider value of information.

Keep the best observed setting distinct from a proven optimum. Repeat noisy measurements where the decision requires it, and preserve the sequence of proposals and outcomes. That record makes the final choice understandable even when a later experiment improves it.

Frequently asked questions

How does this differ from a grid search?

A grid specifies settings independently of previous results. Bayesian optimisation updates a surrogate model after each evaluation and uses it to choose the next experiment (Jones 1998).

Is model uncertainty a guaranteed error bound?

No. It is conditional on the Gaussian process and its assumptions. Kernel, smoothness, measurement noise and model fitting influence practical performance (Snoek 2012).

Sources and further reading

  1. PaperJones, D. R., Schonlau, M. and Welch, W. J. (1998): Efficient Global Optimization of Expensive Black-Box Functions.
  2. PaperSnoek, J., Larochelle, H. and Adams, R. P. (2012): Practical Bayesian Optimization of Machine Learning Algorithms.

Content last reviewed on 14 November 2026. Please let us know about any errors: impressum@nyxai.com.

From NyxAI

smartlytics is the learning hub of NyxAI GmbH.

Explore the methods we work with, explained openly, with sources and calculations you can reproduce.

Decision Core

NyxAI is developing a Decision Core for Decision Intelligence that combines optimisation, simulation, statistics and reinforcement learning: compare options, make uncertainty visible and learn from outcomes, with people in control.

DeepSquare

Explainable chess AI with human playing styles: NyxAI’s testing ground for understandable decisions under time pressure.