Choosing the next simulation

The next solver run: where the surrogate is uncertain or a better design is likely.

Outcome: Run a sequential design loop: fit, choose, simulate, refit; choose the next run by uncertainty or by expected improvement; decide when to stop adding runs.

Builds on Calibrated uncertainty, Sampling the design space

A space-filling design (sampling) spreads runs evenly before anything is known. Once a first surrogate exists, it can estimate where the next run would teach it most. The button in Figure 3-2 that adds a run where σ\sigma is largest does this once, by hand; this lesson turns it into a loop.

DefinitionActive learning

Choosing runs one batch at a time, each where the current surrogate estimates the next run would teach it most. It is also called sequential design.

The loop has four steps:

  1. Run an initial space-filling design, smaller than one used on its own.
  2. Fit a surrogate that estimates its uncertainty: a Gaussian process, or an ensemble.
  3. Score a large set of candidate designs with an acquisition function, and pick the best.
  4. Run the solver there, add the result, refit. Stop when the budget is spent or the score stops improving.

Acquisition functions

Uncertainty sampling picks the candidate with the largest σ\sigma (Gramacy 2020, chapter 6). It sends runs where the model is least sure, which suits a general-purpose surrogate.

Expected improvement (EI, Jones et al. 1998) picks the candidate with the largest expected gain over the best design so far: the chance of beating it, weighted by how much. It balances exploiting good regions against exploring uncertain ones. This same loop, aimed at the best design rather than at a good model everywhere, is Bayesian optimisation, and EI is a common choice for it.

EI(x)=(f∗−μ(x)) Φ(z)+σ(x) φ(z)z=f∗−μ(x)σ(x)\begin{aligned} \mathrm{EI}(x) &= \big(f^* - \mu(x)\big)\,\Phi(z) + \sigma(x)\,\varphi(z) \\ z &= \frac{f^* - \mu(x)}{\sigma(x)} \end{aligned}
(8-2)
f∗f^* is the best value so far (minimising); μ(x)\mu(x) and σ(x)\sigma(x) are the GP mean and standard deviation at xx; Φ\Phi and φ\varphi are the standard normal CDF and density. Where σ(x)=0\sigma(x) = 0, as at a run already made with a noise-free solver, EI is max⁡(f∗−μ(x),0)\max(f^* - \mu(x), 0).

For expected improvement, batches and constraints, a library such as BoTorch saves writing them by hand.

Uncertainty sampling on the aircraft

The download’s runs are all computed already, so Example 8-2 treats the 44 Latin-hypercube runs as the pool of candidates and “runs the solver” by looking a run up. It starts from 8 of them, adds 12 by uncertainty sampling, and measures each round on the 12 test runs, eight of which lie outside the training box. Each printed row gives the round, the number of runs, the test RMSE of CLC_L and the largest σ\sigma left in the pool.

Example 8-2. Uncertainty sampling with a Gaussian process over the aircraft’s runs, with scikit-learn
import numpy as np
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF
from aircraft import load_runs, scale_designs, split_runs

d = load_runs()
train, val, test, in_box = split_runs(d)
X, _, _ = scale_designs(d, train)  # scaled as in 4.3
CL = d["CL"]

def solver(runs):
    # The runs are done already: "running" one is a lookup.
    return CL[runs]1

pool = sorted(np.r_[train, val])  # the 44 LHS runs
rng = np.random.default_rng(0)
picked = list(rng.choice(pool, 8, replace=False))  # 8 initial runs
for i in picked:
    pool.remove(i)

for step in range(12):          # 12 more runs, one by one
    kernel = 1.0 * RBF([1.0, 1.0], (0.05, 100.0))
    gp = GaussianProcessRegressor(kernel, alpha=1e-6,
                                  normalize_y=True)
    gp.fit(X[picked], solver(picked))
    _, std = gp.predict(X[pool], return_std=True)2
    err = gp.predict(X[test]) - CL[test]3
    rmse = np.sqrt(np.mean(err**2))
    print(step, len(picked), f"{rmse:.4f}", f"{std.max():.4f}")
    # The run left in the pool where the model is least sure.
    picked.append(pool.pop(std.argmax()))4
  1. With a real solver this line is one expensive run; here it reads the stored CLC_L.
  2. return_std=True also returns σ\sigma, the GP’s standard deviation, at every run left in the pool.
  3. The test runs only measure progress; they never steer the choice of the next run.
  4. pool.pop takes the chosen run out of the pool, so it cannot be picked twice, and picked.append adds it to the training runs.

Example 8-2 prints a test RMSE that falls from 0.0048 on 8 runs to 0.0005 on 19 in the last row printed, and the largest σ\sigma falls with it, from 0.0028 to 0.0002, so σ\sigma works here as a stopping signal. The first 8 runs already give a test RMSE below 0.005, because the lift of this solver is smooth in α\alpha and Λ\Lambda.

In practice

Batches. A cluster runs many simulations at once. The 10 candidates with the largest σ\sigma tend to sit side by side; batch methods such as the kriging believer (Ginsbourger et al. 2010) add one point, take its result as known, update σ\sigma, and pick the next.

Neural surrogates. The spread of an ensemble, say five members, serves as σ\sigma. Retraining it every round is the main added cost. Fine-tuning from the previous round reduces it, though warm-started networks can generalise worse than fresh ones (Ash and Adams 2020), so the two should be compared on held-out runs. A single network that predicts its own standard deviation avoids the ensemble: Winovich et al. 2026 report that, on two 2D test equations, selection by such an estimate improved on random selection after an initial calibration period. PhysicsNeMo ships active-learning examples.

Aimed at the best design in place of the best model, the same loop is an optimiser. The next lesson starts from the other way to search a surrogate, its gradients.