Bayesian search intuition
Quick answer
Bayesian optimization uses the results of earlier trials to guide which configuration to try next. A surrogate predicts the objective and an acquisition rule balances promising configurations against uncertain regions. Unlike random search, trial outcomes affect future suggestions. Static examples tested locally with Python 3.13.5, scikit-learn 1.8.0 SciPy 1.17.0 and NumPy 2.3.5 where imported. ByteMind package execution is unverified.
Rank candidate acquisitions
means=[0.8,0.7];std=[0.01,0.2]for beta in [0,1]: print(max(range(2),key=lambda i:means[i]+beta*std[i]))Observed local output:
01Increasing the uncertainty bonus changes the selected candidate.
How it works
For a maximized validation score, an illustrative upper-confidence-bound rule is acquisition(x) = mean(x) + beta * standard_deviation(x), with beta nonnegative. The uncertainty bonus encourages exploration, while the mean favors exploitation. A Gaussian process is one possible surrogate; tree-based methods are also used, particularly with mixed or conditional spaces. After an initial design, fit a surrogate to completed trials, optimize the acquisition over feasible settings, evaluate a new configuration on fixed development folds, and update the trial history. For minimization, use an appropriately signed acquisition (or negate the loss). Expected improvement uses the distribution of improvement over an incumbent, not merely the predicted mean. Noisy CV results, failure constraints and training costs complicate acquisition. A surrogate standard deviation is model uncertainty, not a calibrated guarantee of model accuracy. A one-dimensional hand-built GP illustration is not a full Bayesian optimizer; real systems need acquisition optimization, appropriate kernels, noise treatment and reproducibility logs.
Update a Gaussian process surrogate
import numpy as npfrom sklearn.gaussian_process import GaussianProcessRegressorfrom sklearn.gaussian_process.kernels import RBFx=np.array([[0.],[2.]]);y=np.array([0.6,0.8]);q=np.array([[1.]])a=GaussianProcessRegressor(kernel=RBF(1),optimizer=None,alpha=1e-6).fit(x,y)b=GaussianProcessRegressor(kernel=RBF(1),optimizer=None,alpha=1e-6).fit(np.vstack([x,q]),[0.6,0.8,0.9])_,s1=a.predict(q,return_std=True);_,s2=b.predict(q,return_std=True)print(bool(s2[0]<s1[0]))Observed local output:
TrueObserving the query location reduces posterior uncertainty for this fixed-kernel model.
Common mistakes
Do not call independent random samples Bayesian optimization, use a negative uncertainty bonus for a maximization UCB, or tune the acquisition using final test accuracy. Avoid interpreting surrogate confidence as a deployment guarantee.
Practice and next steps
Compute UCB for two candidates with means 0.8 and 0.7 and standard deviations 0.01 and 0.2. Compare beta=0 and beta=1 and explain exploration. Complete the knowledge check and staged exercise. Next: Successive halving.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Bayesian search intuition — knowledge check
Apply bayesian search intuition to new scenarios.
What distinguishes Bayesian search?
What does beta control in UCB?
What is a surrogate?
Can UCB guarantee best deployment accuracy?
What should failed trials be?