BayesianOptimizer#

class BayesianOptimizer(measure_func, optimization_map, initial_samples=10, iterations=100)[source]#

Bases: Optimizer

Minimize the outcome of a measurement using Bayesian optimization [13].

This is useful if the evaluation of the measurement is costly. This class is mostly a wrapper around the implementing package, see BayesianOptimization.

__init__(measure_func, optimization_map, initial_samples=10, iterations=100)[source]#
Parameters:
  • measure_func (Callable[[Array], Float]) – Function implementing measurement of observables to be minimized.

  • optimization_map (OptimizationMap) – All optimizable parameters via the optimization map.

  • initial_samples (int) – Number of initial samples explored before the search for the maximum starts.

  • iterations (int) – Number of iterations where the method attempts to find the maximum value.

Methods

__init__(measure_func, optimization_map[, ...])

optimize(times)

Optimize the system via the Bayesian optimizer.

Attributes

initial_samples

Get the initial samples fed to the system.

iterations

Get the iterations of the system.

logger

Returns the current logger that is being used by this optimizer, or None if no logger was set yet.

optimization_map

Return the optimization map that this optimizer uses.

property initial_samples: int#

Get the initial samples fed to the system.

property iterations: int#

Get the iterations of the system.

property logger: Logger | None#

Returns the current logger that is being used by this optimizer, or None if no logger was set yet.

property optimization_map: OptimizationMap#

Return the optimization map that this optimizer uses.

Parameters that can be optimized need to be added to this map.

Returns:

The optimization map that this optimizer uses.

optimize(times)[source]#

Optimize the system via the Bayesian optimizer.

Performs the actual optimization.

Note

If input times is a float, then the start time of propagation is implicitly assumed to be zero. For an array of times, the first time point is the start time.

Parameters:

times (Array | float) – Array of times or a float (assumed start time zero).

Returns:

Result of optimization (status, value, iterations, and the raw result).

Return type:

OptimizationResult