metaheuristic_designer.operators.BO_operator module#

Bayesian Optimization operator based on Gaussian Process regression.

class BOOperator(objfunc, initializer=None, name='Gaussian Regression Surrogate Model', encoding=None, kernel=None, rng=None, batch_size=100, max_samples=100, rbf_scale=1.0, **kwargs)[source]#

Bases: Operator

Bayesian Optimization operator using a GP surrogate.

Fits a Gaussian Process model to the current population, then maximizes the Expected Improvement acquisition function to propose a new candidate solution. The new solution is merged back into the population.

Parameters:
namestr, optional

Display name (default "Gaussian Regression Surrogate Model").

encodingEncoding, optional

Encoding applied to the genotype.

kernelsklearn Kernel, optional

GP kernel. Defaults to RBF(length_scale=1.0) + WhiteKernel(noise_level=1.0).

rngRNGLike, optional

Random number generator.

batch_sizeint, optional

Number of random starting points for acquisition optimization (default 100).

max_samplesint, optional

Maximum number of training points used (default 100). If the population exceeds this, a random subset is selected.

rbf_scalefloat, optional

Multiplicative factor applied to the RBF kernel (default 1.0).

**kwargs

Additional keyword arguments stored as schedulable parameters.

Attributes:
params

Access parameter values by attribute-style lookup.

Parameters:
  • objfunc (ObjectiveFunc)

  • initializer (Initializer)

  • name (str)

  • encoding (Optional[Encoding])

  • kernel (Optional[Callable])

  • rng (Optional[RNGLike])

  • batch_size (int)

  • max_samples (int)

  • rbf_scale (float)

Methods

__call__(population)

Shorthand for evolve().

evolve(population)

Fit GP, optimize acquisition, and merge the proposed point.

gather_params()

Return the current parameter dictionary (thin wrapper around get_params()).

get_params()

Return a copy of the current parameter dictionary.

get_state()

Gets the current state of the algorithm as a dictionary.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update([progress])

Updates the internal parameters.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

evolve(population)[source]#

Fit GP, optimize acquisition, and merge the proposed point.

Return type:

Population

Parameters:
populationPopulation

The current population.

Returns:
Population

The population with the new candidate appended.

Parameters:

population (Population)