Explanation of the Gaussian Process and Bayesian Optimization Simulator — What the Prediction Line, the Confidence Width, and Auto-Pick’s Choice Compute
This page explains, in the order words → formulas → calculation procedure, which quantities of Gaussian process regression and Bayesian optimization correspond to the “prediction line,” the “confidence width,” and the rule by which “Auto-pick” chooses the amount to measure next, as seen in the simulator, and by what formulas they are computed. The procedure for the detailed view, the conditions of the calculation, and questions for checking are also collected here.
The Gaussian Process and Bayesian Optimization Simulator is a device for watching how we predict, from measured points, “the values where we have not measured” and their uncertainty, and how we use that prediction to decide “where to measure next.” It covers Gaussian process regression in Chapter 12 (Gaussian Process Regression) and Bayesian optimization in Chapter 13 (Bayesian Optimization and Experimental Design). In both, the function studied is Data C, “Dopant Amount and Ionic Conductivity,” of Chapter 12 (synthetic data for teaching purposes).
The simulator has two views.
Simple view (the view shown when the page opens): you watch, with pictures and motion, Scene A, in which the prediction line and the “confidence width” are redrawn each time a sample is made and its performance is measured, and Scene B, in which the next amount to measure is chosen by “Auto-pick” and compared with “Random pick,” which chooses at random. No formulas are shown.
Detailed view: the view embedded in Chapters 12 and 13 of the text. You check with numbers and formulas the predictive mean, the two kinds of bands, and the log marginal likelihood in ① (Gaussian process regression); the points chosen by the acquisition functions (EI, UCB, PI) in ② (Bayesian optimization); and the distribution of the simple regret in ③ (comparison with random search). The procedures of “Simulator 12.1,” “Simulator 13.1,” and “Simulator 13.2” in the text are written for this view.
Scene A of the simple view performs the same computation as ① of the detailed view, and Scene B the same as ② and ③. We recommend reading in this order: try the simple view, check what it really shows in Section 2, read the formulas in Section 3, and operate the detailed view with the procedure in Section 4.
2. What the simple view really shows
The “prediction line” in the simple view is the predictive meanμ*(x) of Gaussian process regression, and the “confidence width” band is, at a dopant amount x not yet measured, the width of the predictive distribution for the true function value f(x) (the latent function), μ* ± 2σ* (about 95 %). σ* is the predictive standard deviation and expresses “how much we do not know” (Section 13.2 of the text). Where the band is narrow, the value is well known; where it is wide, the value is not yet well known. This is the same as the “latent-function band” of ① in the detailed view; the “observation band” (Section 12.6), which also includes the scatter of the observed value at the next measurement, is not drawn in the simple view.
The vertical axis, “Performance (pts),” is the value y of Data C (the logarithm of the ionic conductivity) converted into a score by the following linear formula.
The global maximum of the true function, y = −3.4 (7.0 mol%), corresponds to 100 pts, y = −5.0 to 0 pts, and the local maximum y ≈ −4.0 (2.2 mol%) to 62.5 pts. Because the formula is linear, the shape of the band and the point chosen by the acquisition function do not change (the band width is read in points, multiplied by 62.5). The observed values carry noise (standard deviation 0.05, about 3 pts), so a measured performance can be slightly above 100 pts or slightly below 0 pts.
2.1 Scene A: Can we predict the performance where we have not measured?
Choose an amount of additive x, make a sample, and measure its performance y (“▶ Make a sample and measure” or a click on the figure). Each time you measure, Gaussian process regression is redone from all the observations so far, and the prediction line and band are redrawn. The edges of the band from before the button was pressed are left as faint dashed lines.
Table 1: Words on the screen in Scene A and the corresponding terms and symbols
Words on the screen
Term
Symbol or formula
Amount of additive (horizontal axis)
Input
x (mol%)
Performance (vertical axis, pts)
Target value (Data C)
y (on screen, 62.5(y + 5) pts)
Measured performance (●)
Observed value
yn = f(xn) + εn, εn ~ 𝒩(0, 0.052)
Prediction line
Predictive mean
μ*(x)
Confidence width (band), band width ±
Latent-function band (about 95 %)
μ* ± 2σ*
Where to measure ▼, Prediction at ▼
Test input and the prediction there
x*, μ*(x*) ± 2σ*(x*)
Where the band is widest
Input with the largest predictive standard deviation
argmax σ*(x) (on the grid of 201 points)
Smoothness of the prediction line (assumption)
Length scale of the RBF kernel
ℓ
Bumpy / Medium / Gentle
ℓ = 0.3, 1, 10 mol%
Small curve on each choice
Sample from the prior (one)
f ~ 𝒢𝒫(0, k)
Hidden true curve (Check the answer)
True function of Data C
y(x) = −5.0 + 1.0 exp[…] + 1.6 exp[…]
When the page opens, three places, 1.6, 5.2, and 8.2 mol%, have already been measured. Right on the measured places the band narrows, and about 2 mol% (twice ℓ) away from them the band returns to nearly its width with nothing measured (±2σf = ±1.6, or ±100 pts). At the initial position of ▼, 3.4 mol%, the prediction is 39 pts and the band width is ±96 pts.
Numbers for “Try it”:
What if we measure at 8 places?: the same 8 places as “Place the example 8 points” in ① of the detailed view (0.4, 1.6, 2.8, 4.0, 5.2, 6.4, 8.2, 9.4 mol%) are measured with the same random numbers (seed 20261112). Right on the measured 6.4 mol%, the band width is ±6 pts (σ* = 0.0499); at 7.0 mol%, which is not measured, it is ±36 pts (σ* = 0.2897), about 6 times as wide. These two values of σ* are the same as the values in step 2 of Simulator 12.1 in Chapter 12.
What if we measure the gap once?: after the 8 places, measuring at 7.3 mol% gave a performance of 94 pts. The band width at 7.0 mol% narrows from ±36 pts to ±8 pts (σ* = 0.0650).
What if we assume it is gentle?: with the same 8 places and ℓ = 10 mol%, the band width at 7.0 mol% narrows to ±3 pts, but at 187 of the 201 grid points (about 93 %) the true curve sticks out of the band. With ℓ = 1 mol%, there are 0 such points. ℓ = 10 mol% is as long as the width of the horizontal axis (0–10 mol%), so the prediction line becomes an arc that bends gently only once over the whole range (not straight; it differs from a quadratic by at most 4 pts). This cannot represent the two peaks.
Where the analogy fits and where it does not
Where it fits: the prediction line and band are computed with the same settings as the defaults of ① in the detailed view (RBF kernel, σf = 0.80, model noise σ = 0.050, the mean of the observed values ȳ as the mean function m) and with the same functions (gpFit and gpPredict in gp-bo.model.js). “Medium” is the default of ① in the detailed view, ℓ = 1.00 mol%. The measured performance is the true value of Data C plus noise with standard deviation 0.05.
Where it does not fit: the performance curve is synthetic data for teaching purposes, not the values of a real material. In real experiments on materials, the input usually has many dimensions, such as composition, temperature, and time, and the size of the noise is usually unknown. Also, the band is the width “if the assumptions, such as the smoothness of the prediction line (ℓ), are correct.” As in the “Gentle” example, if the assumption does not fit, the band is narrow but wrong. A method of choosing ℓ from the data (the log marginal likelihood) can be tried in ① of the detailed view.
2.2 Scene B: Can we find the best with only a few experiments?
With the same Data C, we search for the dopant amount with the highest performance in 20 experiments. “Auto-pick” is Bayesian optimization. From the observations so far, it makes the same prediction line and band as in Scene A, and next measures where the acquisition function EI (expected improvement) is largest. “Random pick” is random search, which chooses an amount from 0–10 mol% with a uniform random number. The first 3 tries have no clues, so both choose with uniform random numbers (initial points; since the random-number seeds differ, the 3 places differ between Auto-pick and Random pick). When the page opens, it draws the state after these first 3 tries (3 / 20 tries). Each press of “▶ Auto-pick the next experiment” advances both by one experiment. The first press is the 4th experiment, the first point that Auto-pick chooses from the prediction line and band.
Table 2: Words on the screen in Scene B and the corresponding terms and symbols
Initial points (uniform random; already done when the page opens)
n0 = 3
Points chosen by Auto-pick (●)
Point that maximizes the acquisition function
xn+1 = argmax EI(x)
Next here (▼)
Next candidate
argmax on the grid of 401 points (spacing 0.025 mol%)
Worth measuring (peaks in the lower strip)
Acquisition function EI
EI(x) (the height is drawn divided by the maximum; when the maximum is less than 0.01 pts, the screen says “almost 0 everywhere”)
Best (◆)
Recommended point (the point with the largest observed value)
x̂n
Gap from the true best
Simple regret (in pts)
62.5 × rn, rn = ymax − y(x̂n)
Match result
Comparison of the simple regret with the same budget
the one with the smaller r20 at the 20th try wins
Rematch with a new start
Advance the repetition number r of ③ by one
seed assignment in Section 5.2
The match shown when the page opens is the same as repetition r = 2 among the default 200 repetitions of ③ in the detailed view (seed 20261114 for Bayesian optimization, seed 20361114 for random search). In ② of the detailed view, if you set the seed to 20261114 and keep pressing “Observe next point,” you get the same sequence as Auto-pick.
Numbers for “Try it”:
After the first 3 tries, where does it pick?: go forward just once from the state after 3 tries. The initial points of Auto-pick are 1.30, 1.97, and 2.39 mol%, all three near the local maximum (2.2 mol%). The candidate for the 4th try is 10.00 mol%, where the predictive standard deviation is σ* = 0.800 (the same as σf of the prior; a place not yet measured). The prediction there is 48 pts, lower than the highest measured value of 60 pts on the left peak, yet it is chosen. The initial points of Random pick are 6.36, 2.85, and 2.96 mol%.
What if they compete over 20 tries?: Auto-pick measures 7.05 mol% (within 0.5 mol% of the true best) on the 7th try. The recommended points at the 20th try are 6.85 mol% for Auto-pick (gap 0.9 pts) and 6.41 mol% for Random pick (gap 13 pts), so Auto-pick wins. The gaps at the 10th try are 0.1 pts for Auto-pick and 16 pts for Random pick. In the default 200 repetitions of ③, Auto-pick had the smaller gap in 163 of them (81.5 %, Table 13.2 in Chapter 13).
What if we assume it is gentle?: with ℓ = 10 mol% (the same length scale as “BO loses” in ③), the first measurement within 0.5 mol% of the true best comes on the 17th try (6.55 mol%), later than the 7th try with “Medium.” The gap at the 10th try is 40 pts (16 pts for Random pick), and the gap at the 20th try is 8.0 pts (Random pick has 13 pts, so this match is still a win for Auto-pick). For the candidates from the 7th try on, the maximum of EI is less than 0.01 pts (on screen, “almost 0 everywhere”), and for the candidates of tries 18–20, EI is 0 everywhere in double precision, so the left end of the grid (0 mol%) is chosen (Section 5.4).
Where the analogy fits and where it does not
Where it fits: Auto-pick uses the same settings as the defaults of ② in the detailed view (maximization, EI, ξ = 0, fbest is the best observed value, 3 initial points, budget 20, ℓ = 1.00 mol%, σf = 0.80, σ = 0.050) and the same functions (boCreate, boStep, boModel). Random pick uses the same function as the random search of ③ (randomRun), and the match is judged by the same simple regret as in ③.
Where it does not fit: “Auto-pick” is not a mechanism that knows everything; it merely chooses the next amount by one fixed rule called EI. Besides EI there are other rules, such as UCB and PI, and the chosen point changes with the rule (② of the detailed view). Also, the “gap from the true best” and the “match result” can be computed only because we know the answer (the true function); in real experiments they are unknown. The win or loss of a single match changes with how it starts (the random numbers), so methods are compared by the distribution over many repetitions (③ of the detailed view).
3.1 Placing a distribution on functions — narrow near measured places, wide far from them
A Gaussian process places a probability distribution on the function f(x) itself. The distribution of functions is fixed by the property that, whatever finite set of inputs x1, …, xN is chosen, the set of function values there follows a multivariate Gaussian distribution (Section 12.1 of the text). The distribution is determined by the mean function m and the covariance function (kernel) k, and the kernel expresses “how similar the values at two inputs are.” With the RBF kernel, if the distance between two inputs is much shorter than the length scale ℓ, the values are almost the same, and if the inputs are several times ℓ apart, the values are unrelated (Section 12.2 of the text). The “Smoothness of the prediction line” in the simple view is the choice of this ℓ.
When there are observations, the predictive distribution at unmeasured places is obtained by applying the formula for the conditional distribution to the joint distribution with the observed values (Section 12.4 of the text). With only one observation (x1, y1), it becomes the following short formula (Section 13.3 of the text; σf2 is the signal variance and σ2 is the noise variance).
Near the observation point (ρ ≈ 1), the predictive mean is pulled toward the observed value y1 and the variance becomes small. Far away (ρ ≈ 0), the predictive mean returns to m and the standard deviation to σf. Even with more observations, this property, “pulled in and narrow nearby, back to the prior and wide far away,” does not change. This is why, in Scene A of the simple view, the band narrows at measured places and swells away from them. The predictive variance does not depend on the data values; it only decreases from the prior variance (summary in Section 12.13 of the text).
3.2 Formulas for the predictive distribution and the marginal likelihood
For the Gaussian process f ~ 𝒢𝒫(m, k), the covariance function is the RBF (Gaussian) kernel, with length scale ℓ and signal variance σf2. The mean function m is a constant.
From N observations y and Ky ≡ K + σ2I (K ∈ ℝN×N is the Gram matrix), at the test input x*, the latent function f* has the predictive distribution 𝒩(f* | μ*, σ*2), and the observation y* has the predictive variance
Here, k* = (k(x1, x*), …, k(xN, x*))T, θ = (ℓ, σf, σ). No matrix inverse is formed. The Cholesky decomposition Ky = LLT is computed only once, and forward and backward substitution give a = LT\(L\(y − m1)) and v = L\k*; then μ* = m + k*Ta, σ*2 = k(x*, x*) − vTv, and ln |Ky| = 2 Σi ln Lii (the same procedure as Algorithm 2.1 in the textbook by Rasmussen and Williams). If the decomposition fails, a small value (jitter) is added to the diagonal and the decomposition is retried; the amount added is shown on screen. If rounding makes σ*2 negative, it is clipped to 0 and the number clipped is shown.
3.3 Bayesian optimization — where the prediction is high, or where the band is wide
Bayesian optimization repeats the following: from the predictive mean μ*(x) and the predictive standard deviation σ*(x) given by the surrogate model (here a Gaussian process), it builds an acquisition function that turns “the value of measuring x next” into a single number, and next measures where that function is largest (Section 13.2 of the text). Measuring where the predictive mean is high is exploitation, and measuring where the band is wide is exploration (Section 13.3 of the text). EI combines both in one formula.
The first term is the part determined by the improvement d (how much the prediction exceeds fbest), and the second term is the part that grows as σ* grows (the wider the band). At the 4th try in Scene B of the simple view, 10.0 mol% was chosen even though its prediction is below fbest (d < 0), because the band there is wide; this is mainly due to the second term.
In Bayesian optimization (tabs ② and ③), taking the best observed value fbest as the reference, the acquisition function is evaluated on a grid of 401 points (spacing 0.025 mol%) and the best point is observed next. z = (μ* − fbest − ξ)/σ*, and Φ is the cumulative distribution function of the standard Gaussian distribution.
Sign conventions for maximization and minimization (switchable in tab ②; as the minimization example, we solve the same problem rewritten as the minimization of g(x) = −y(x)):
Maximization (default in the text)
Minimization
fbest
maximum so far
minimum so far
Improvement
μ* − fbest − ξ
fbest − μ* − ξ
EI
(improvement) Φ(z) + σ* 𝒩(z | 0, 1), z = improvement / σ* (in both cases the point with the maximum is chosen)
PI
Φ(z) (the point with the maximum is chosen)
Confidence bound
UCB = μ* + κσ* is maximized
LCB = μ* − κσ* is minimized
fbest can be switched between “the best observed value” and “the best posterior mean μ*(xn) over the observed points.” The simple regret is rn = ymax − y(x̂n), where x̂n is the point with the largest observed value up to evaluation n (the recommended point), y(x̂n) is the true function value at that point, and ymax = −3.400 (at x = 7.000 mol%) is the true maximum value.
3.4 Calculation procedure
Decide the kernel hyperparameters (ℓ, σf, σ) and the mean function m (by default, the mean of the observed values ȳ).
Form Ky = K + σ2I and perform the Cholesky decomposition Ky = LLT once (if it fails, add jitter and retry).
At each grid point x*, obtain μ* and σ*2 by forward and backward substitution, and draw the prediction line and the band μ* ± 2σ* (the curves use 201 points).
In Bayesian optimization, compute EI on the grid of 401 points and observe the point xn+1 where it is largest (the 3 initial points are uniform random). Add the observation, return to step 2, and repeat until the budget of B evaluations is used up.
Take the recommended point to be the point x̂n with the largest observed value, and compute the simple regret rn with the true function. Random search is compared with the same budget and the same recommendation rule.
The simple view calls the same functions as the detailed view (gpFit, gpPredict, gpPredictOne, observeC, boCreate, boStep, boModel, randomRun, recommend, regretCurve, compareSeeds, sampleFunctions in gp-bo.model.js). The only computations added for the simple view are the conversion to points, the fraction of the curve sticking out of the band, the try on which a place within 0.5 mol% is first measured, the judging of the match, the check of whether “Worth measuring” is almost 0 (maximum less than 0.01 pts), and the small curves on the choices (gp-bo.easy.js).
4. How to use the detailed view
The detailed view has three tabs: “① Gaussian Process Regression,” “② Bayesian Optimization,” and “③ Comparison with Random Search.” Each has the figures and the “Putting the current numbers into the formula” box on the left, and the controls and readout on the right.
In tab ①, press “Place the example 8 points.” What to look for: near the observation points, the latent-function band ±2σ* (filled) becomes narrow and widens between 6.4 and 8.2 mol%, where there are no observations. The observation band ±2√(σ*2 + σ2) (dashed) never becomes narrower than ±2σ = ±0.1, even right on an observation point.
Read the values with the “Query point x*” left at its default 7.0 (where there is no observation point), then move it to 6.4, which is on an observation point (keep the example 8 points). What to look for: in “Putting the current numbers into the formula,” for σ*2 = σf2 − vTv, the subtracted term vTv increases from 0.556 at 7.0 to 0.638 at 6.4 and σ* decreases from 0.290 to 0.050. Return x* to 7.0, then set ℓ to 0.2. At x* = 7.0, vTv ≈ 0, so σ*2 returns to the prior variance σf2 = 0.64 and μ* returns to near the mean function m = −4.469 (−4.459) (far from the data, the prediction simply reverts to the mean function).
Set the length scale ℓ to 0.2 and then to 5. What to look for: when ℓ is small, the mean drops back to m between observation points and the band balloons; when it is large, the two peaks cannot be represented and the fit is poor. In the lower figure, the data-fit term goes down as ℓ is increased, while the complexity-penalty term goes up (the penalty gets lighter).
Press “Grid search: maximize ℓ” and “Grid search: maximize ℓ, σf, σ.” What to look for: the ℓ that maximizes the log marginal likelihood, and the values of the three terms there. With little data, the maximum is flat and the selected value cannot be trusted.
Display “Samples from the prior” and “Samples from the posterior,” and vary ℓ. What to look for: how fine the waves of the prior samples are is determined by ℓ. Near the observation points the posterior samples pass close to the observed values; farther away they scatter like the prior samples.
In tab ②, press “Observe next point” repeatedly (default: EI, ξ = 0, 3 initial points). What to look for: the acquisition function (lower figure) becomes large both “where the predictive mean is high” and “where the band is wide,” and the observations gather near the global maximum (about 7.0 mol%) rather than the local maximum (about 2.2 mol%). Also look at the history table and the simple regret.
In tab ②, switch to “Minimize −y,” press “Restart,” and advance the same number of steps. What to look for: minimization uses LCB and an EI adapted to the sign convention, but since this merely flips the sign of the objective function, with the same seed the sequence of observed points matches that of maximization exactly.
In tab ③, press “Run” (default: 200 repetitions, budget 20). Then press “BO loses (ℓ = 10 fixed, B = 30)” and run it. What to look for: the median and interquartile range (band) of the simple regret. By default, the median for Bayesian optimization is nearly an order of magnitude smaller than that for random search. If the length scale is fixed at 10 mol%, the median becomes larger than that of random search (BO loses).
With the keyboard, move to buttons and sliders with Tab, press with Enter (or Space), and move sliders with the arrow keys. Tabs can be switched with ←→. Clicking the figure in tab ① can also be done with “Dopant amount to observe x” and “Observe at this x” in the right-hand column.
5. Conditions of the calculation
5.1 Data and random-number conditions
All observed values are synthetic data for teaching purposes (Data C, “Dopant Amount and Ionic Conductivity”); they are not measured values of a real material. The dopant amount x ∈ [0, 10] mol%, y = log10(σion / S cm−1) (dimensionless), the true function y(x) = −5.0 + 1.0 exp[−(x − 2.2)2/(2·0.72)] + 1.6 exp[−(x − 7.0)2/(2·1.12)], the observed value = true value + ε, ε ~ 𝒩(0, 0.052) (independent). The local maximum is at x ≈ 2.200 mol% (y ≈ −4.000), and the global maximum is at x ≈ 7.000 mol% (y ≈ −3.400).
The noise standard deviation of the synthetic data, 0.05, is fixed. The slider for σ sets the noise standard deviation assumed by the model and does not affect the synthetic data.
The dopant amounts of the “example 8 points” in tab ① are 0.4, 1.6, 2.8, 4.0, 5.2, 6.4, 8.2, and 9.4 mol% (fixed); only the observation noise is random.
Random numbers come from a seeded generator (mulberry32). The default seed is 20261112 in all of ①, ②, and ③. In ①, if you change the seed, the existing observation points keep their x values unchanged and the observed values are redrawn with new random numbers. In ②, changing the seed restarts from the beginning (the initial points’ x are uniform random numbers, and the observation noise is drawn from the same random sequence at each observation). In ③, for repetition r (counted from 0), Bayesian optimization uses seed + r, random search uses seed + 100000 + r, and the observation noise of the grid uses seed + 200000 + r. The samples from the prior and posterior use fixed vectors of standard Gaussian random numbers generated with seed + 1 + (number of redraws), so when you vary ℓ and the like, the samples change shape continuously.
Defaults: ℓ = 1.00 mol%, σf = 0.80, σ = 0.050, the mean function m is the mean of the observed values ȳ (−4.5 when there are no observations). Defaults in ②: maximization, EI (ξ = 0), fbest is the best observed value, 3 initial points, budget 20. Defaults in ③: budget 20, 200 repetitions, EI (ξ = 0), ℓ = 1.00 mol% fixed.
Limits: at most 40 observation points in ①, a budget of at most 40 in ② and ③, and at most 200 repetitions in ③. The grid search in ① uses ℓ 41 points × σf 13 points × σ 21 points (11193 combinations). When “Choose ℓ by marginal likelihood each time” is used in ② and ③, the grid is ℓ ∈ [0.2, 5] mol% with 25 points. The computation in ③ is divided so that each frame takes at most 12 ms, and it can be stopped partway.
5.2 Conditions fixed in the simple view
Common: σf = 0.80, model noise σ = 0.050, and the mean function m is the mean of the observed values ȳ (−4.5 when there are no observations). The smoothness of the prediction line is chosen from three values, ℓ = 0.3, 1, and 10 mol% (default 1 mol%). The band is μ* ± 2σ* (the latent-function band). The performance score is 62.5(y + 5), and the numbers on screen are rounded to 2–3 digits (scores are integers, gaps under 10 pts have 1 decimal place, the amounts in A have 1 decimal place, and the amounts in B have 2 decimal places). The small curve on each choice is a sample from the prior (41 points) that uses one set of standard Gaussian random numbers from seed 20261112 + 7, shared by the three values of ℓ.
A: when the page opens (and on “Start over”), 1.6, 5.2, and 8.2 mol% have been measured in this order with random numbers from seed 20261112, and ▼ is at 3.4 mol%. The amount to measure moves in steps of 0.1 mol%, and at most 40 samples can be measured, as in ①. The random numbers for the observation noise are drawn from the same random sequence in the order of measurement. Each “Try it” item clears the record when pressed and measures again from seed 20261112 (the 8 places in items 1 and 2 have the same values as the “example 8 points” in ① of the detailed view).
B: budget 20 (including the 3 initial points), EI (ξ = 0), fbest is the best observed value, maximization. For match number r, the seed of Auto-pick is 20261112 + r and the seed of Random pick is 20261112 + 100000 + r (the same assignment as in ③). When the page opens, r = 2, and each press of “Rematch with a new start” advances r by one (after 199 comes 0). Changing the smoothness choice restarts from the beginning with the same r. When the page opens, on “Start over,” on “Rematch with a new start,” and when the choice is changed, the state is always advanced through the first 3 tries (initial points) (the random sequence and the result after 20 tries are the same as when starting from 0 tries). When the 20th try is over, the true curve is shown automatically and the match result is given.
If you switch between A and B in the middle of an animation, the rest is completed without animation and the final state is kept (when you come back, the record is not cut off partway).
If the OS or browser is set to “reduce motion” (prefers-reduced-motion), the animation is skipped and only the result is drawn.
5.3 Simplifications
The input is one-dimensional (the dopant amount only). Real materials searches have several inputs, such as composition, temperature, and time, and the kernel length scale also differs from input to input.
The mean function is a constant. By default, the mean of the observed values ȳ is used, and the log marginal likelihood is computed treating ȳ as a known constant (ȳ itself is determined from the data, so this is slightly optimistic compared with the exact marginal likelihood).
The acquisition function is maximized on a grid of 401 points (in practice, it is usual to run a continuous optimization from many starting points). If several points have the same value, the one with the smaller x is chosen.
The hyperparameters are either fixed or set only by maximizing the log marginal likelihood with a grid search (gradient methods and prior distributions are not used).
The recommended point is “the point with the largest observed value.” Because the observations are noisy, a point that happened to receive favorable noise may be recommended, and the simple regret can temporarily increase even as evaluations accumulate.
For the equally spaced grid, for each number of evaluations n, the simple regret is computed as if the grid that would be placed for a budget of n, xk = 10(k − ½)/n mol% (k = 1, …, n), had been measured.
5.4 Conditions under which results become unstable
If the model noise σ is small and ℓ is large, Ky becomes almost singular. The same happens when the same x is observed many times. The Cholesky decomposition continues by adding jitter, and the amount added is shown in the readout.
If σ is made too small, the predictive mean picks up even the noise and swings widely between observation points (because noisy observations are treated as “exact values”).
With few observations, the maximum of the log marginal likelihood becomes flat, or the maximum lies at an end of the ℓ range. Do not trust the grid-search result as it is; look at the shape of the lower figure.
If fbest is set to the best observed value, a point hit by large noise becomes the reference, and EI and PI become small, so the search tends to stall.
If ℓ is made long and σ is made small, σ* becomes small everywhere, and EI and PI can become so small (to 0) that double precision cannot represent them. Then no point can be expected to give an improvement, so the left end of the grid is chosen among the points with the same value (a note is shown in the figure). This is an example of the surrogate model believing “I already know everything” and the search stalling.
If NaN or infinity appears in the computation, the computation is stopped and the reason is shown.
6. Questions for checking
Questions 1 and 2 can be answered with the simple view alone. Questions 3–6 use the detailed view.
In Scene A of the simple view, after pressing “What if we measure at 8 places?”, how does the “confidence width” change when you move ▼ from 6.4 mol% to 7.0 mol%? Why?
Sample answer
It widens from ±6 pts to ±36 pts, about 6 times. 6.4 mol% is a measured place, so the prediction line is pulled toward the observed value there and the band narrows to about the size of the noise. 7.0 mol% lies in the gap between the measured 6.4 mol% and 8.2 mol%, 0.6 mol% and 1.2 mol% away from the observation points on both sides, so the information from the observations reaches it less and the band stays wide (Section 3.1).
At the 4th try in Scene B of the simple view, why did Auto-pick choose 10.0 mol%, where the prediction is low? How is it different from Random pick?
Sample answer
10.0 mol% is a place not yet measured, where the band is as wide as the prior and the real value might be higher. EI becomes large not only where the prediction is high but also where the band is wide (the second term in Section 3.3). Random pick chooses amounts without using the prediction or the band, so it may measure the same place many times or measure places already known to be low. Once Auto-pick has checked a wide-band place and found a high peak, it then concentrates on places where the prediction is high.
In tab ①, after pressing “Place the example 8 points” (default seed), at x* = 7.0 mol%, what are σ* and √(σ*2 + σ2)? What about exactly on an observation point (x* = 6.4)? Why does the observation band never become narrower than ±2σ?
Sample answer
With the defaults (ℓ = 1.00 mol%, σf = 0.80, σ = 0.050, m = ȳ = −4.469), at x* = 7.0 we get σ* = 0.290 and √(σ*2 + σ2) = 0.294, so the two bands have almost the same width (the point is far from the observation points, σ* ≫ σ). On an observation point, x* = 6.4, σ* narrows to 0.0499, but √(σ*2 + σ2) = 0.0706. The variance of the next observed value is σ*2 + σ2 ≥ σ2, so no matter how accurately f is known, the part due to observation noise cannot be predicted.
What does the formula for EI become when σ* → 0? Why is EI almost 0 on an observation point?
Sample answer
z = (μ* − fbest − ξ)/σ* goes to +∞ if the improvement is positive and to −∞ if it is negative, so Φ(z) → 1 or 0, 𝒩(z | 0, 1) → 0, and EI → max(μ* − fbest − ξ, 0) (the improvement of a value known with certainty). On an observation point, σ* is small and μ* is near the observed value at that point, which is at most fbest, so almost no expected improvement remains.
In tab ②, if you run maximization and minimization (minimizing −y) with the same seed and the same number of steps, what happens to the sequence of observation points? Why?
Sample answer
They match exactly. Flipping the sign of the objective function flips the sign of the posterior mean (μ* is linear in y) and leaves the posterior variance unchanged. fbest also flips sign, so the improvement in minimization fbest − μ* − ξ has the same value as the improvement in maximization; EI and PI take the same values, and LCB is UCB with the sign flipped.
With the defaults of tab ③ (budget 20, 200 repetitions), what are the medians of the simple regret at evaluation 20 for Bayesian optimization and for random search? What happens in “BO loses”? Why does it lose?
Sample answer
With seed 20261112 and 200 repetitions, the median [interquartile range] of the simple regret at evaluation 20 is 0.0037 [0.00041, 0.010] for Bayesian optimization and 0.031 [0.0053, 0.088] for random search (0.041 for the equally spaced grid). Comparing paired repetitions, Bayesian optimization was smaller in 81.5 % of them, so it does not always win. In “BO loses” (ℓ = 10 mol% fixed, budget 30), the medians are 0.049 [0.012, 0.13] for Bayesian optimization and 0.019 [0.0032, 0.054] for random search, so Bayesian optimization loses (the fraction of repetitions in which Bayesian optimization was smaller is 36.5 %). If ℓ is too long compared with the peak widths (0.7 mol% and 1.1 mol%), the surrogate model is too smooth to represent the peak positions correctly and, moreover, underestimates σ*, so it measures only near the wrong place and stops exploring. If the surrogate model is wrong, the search is wrong too (in tab ①, when ℓ = 5 is applied to the example 8 points, the log marginal likelihood is −230, far smaller than −6.5 for ℓ = 1, which shows that the data do not support this ℓ).
7. Corresponding sections of the text and references
C. E. Rasmussen and C. K. I. Williams, Gaussian Processes for Machine Learning, MIT Press (2006) (the standard textbook on Gaussian process regression; Chapter 2 covers regression, and Chapter 5 covers hyperparameters and model selection).
D. R. Jones, M. Schonlau, W. J. Welch, “Efficient Global Optimization of Expensive Black-Box Functions,” Journal of Global Optimization13, 455 (1998) (the EGO algorithm using a surrogate model and expected improvement).
B. Shahriari, K. Swersky, Z. Wang, R. P. Adams, N. de Freitas, “Taking the Human Out of the Loop: A Review of Bayesian Optimization,” Proceedings of the IEEE104, 148 (2016) (a review).