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: object

Stateful ask-tell wrapper around the GP Bayesian-optimization loop.

ask proposes the next point (or a batch), tell records evaluated observations, and best returns the incumbent. Minimizes by default; set maximize=True to maximize. The acquisition is selected by acq ("ei" / "pi" / "ucb" or any registered name / callable) with per-acquisition parameters in acq_kwargs.

Parameters:
  • bounds (Bounds)

  • acq (str | Acquisition)

  • acq_kwargs (dict[str, Any] | None)

  • maximize (bool)

  • n_init (int | None)

  • xi (float)

  • n_candidates (int)

  • fit_kwargs (dict[str, Any] | None)

  • seed (int | RandomState | None)

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 when q > 1.

The first n_init points come from a space-filling design; subsequent points are GP acquisition proposals (a kriging-believer batch when q > 1).

Parameters:

q (int)

Return type:

ndarray

tell(x, y)[source]

Record one or more evaluated observations; returns self for chaining.

x is a (d,) point or (m, d) batch and y the matching scalar or (m,) values.

Parameters:
Return type:

BayesianOptimizer