mixle.doe.optimizer module¶
Ask-tell Bayesian-optimization interface for mixle.doe (WS-E).
A small stateful optimizer object for the common human/experiment-in-the-loop workflow, where the objective is expensive or physical and evaluated outside the loop:
opt = BayesianOptimizer(bounds, acq=”ei”) for _ in range(n):
x = opt.ask() # next point(s) to evaluate y = run_experiment(x) # … done by the caller, however slow opt.tell(x, y) # feed the result back
opt.best # best (x, y) so far
It holds the observation history and delegates proposals to the functional API
(mixle.doe.bayesopt): the first n_init asks come from a space-filling Latin-hypercube
design (a GP needs data before it is useful), after which asks are GP-acquisition proposals
(ask(q>1) returns a kriging-believer batch). Constrained and multi-objective problems keep their
functional drivers (constrained_minimize / multi_minimize).
- class BayesianOptimizer(bounds, *, acq='ei', acq_kwargs=None, maximize=False, n_init=None, xi=0.0, n_candidates=512, fit_kwargs=None, seed=None)[source]
Bases:
objectStateful ask-tell wrapper around the GP Bayesian-optimization loop.
askproposes the next point (or a batch),tellrecords evaluated observations, andbestreturns the incumbent. Minimizes by default; setmaximize=Trueto maximize. The acquisition is selected byacq("ei"/"pi"/"ucb"or any registered name / callable) with per-acquisition parameters inacq_kwargs.- Parameters:
- property x: ndarray
Return the observed points as an
(N, d)array.
- property y: ndarray
Return the observed objective values as an
(N,)array.
- property n_observations: int
Return the number of recorded observations.
- property best: BayesOptResult
Return the incumbent (best observed point) as a
BayesOptResult.
- ask(q=1)[source]
Return the next point to evaluate as a
(d,)array, or a(q, d)batch whenq > 1.The first
n_initpoints come from a space-filling design; subsequent points are GP acquisition proposals (a kriging-believer batch whenq > 1).