base#

Optimizer class definition

Classes

Optimizer(X_space[, seed, verbose])

Base class for obsidian optimizer, which fits a surrogate model to data and suggests optimal experiments

class obsidian.optimizer.base.Optimizer(X_space: ParamSpace, seed: int | None = None, verbose: int = 1)[source]#

Bases: ABC

Base class for obsidian optimizer, which fits a surrogate model to data and suggests optimal experiments

X_space#

obsidian ParamSpace object representing the allowable space for optimization.

Type:

ParamSpace

seed#

Randomization seed for the optimizer and stochastic surrogate models.

Type:

int | None

verbose#

Flag for monitoring and debugging optimization output.

Type:

int

Raises:
  • ValueError – If verbose is not set to 0, 1, 2, or 3.

  • TypeError – If X_space is not an obsidian ParamSpace

property X_space#

The parameter space defining the search space for the optimization.

Type:

ParamSpace

abstract fit(Z: DataFrame, target: Target | list[Target])[source]#

Fit the optimizer’s surrogate models to data

hypervolume(f: Tensor, ref_point: list | None = None, weights: list | None = None) float[source]#

Calculates the hypervolume of the given data points.

Parameters:
  • f (Tensor) – The data points to calculate the hypervolume for.

  • ref_point (list, optional) – The reference point for the hypervolume calculation. Defaults to None.

  • weights (list, optional) – The weights to apply to each objective. Defaults to None.

Returns:

The hypervolume value.

Return type:

float

Raises:

UnsupportedError – If the number of objectives is less than or equal to 1.

abstract classmethod load_state(obj_dict: dict)[source]#

Load the optimizer from a state dictionary

abstract maximize()[source]#

Maximize the optimizer’s target(s)

pareto(f: Tensor) list[bool][source]#

Determines the Pareto dominance of a given set of solutions.

Parameters:

f (Tensor) – The input series containing the solutions.

Returns:

A list of boolean values indicating whether each solution is Pareto optimal or not.

Return type:

list[bool]

pf_distance(y: Series) Tensor[source]#

Calculates the pairwise distance between the given input y and the Pareto front.

Parameters:

y (pd.Series) – The input data.

Returns:

The minimum distance between y and the Pareto front.

Return type:

Tensor

abstract predict(X: DataFrame, return_f_inv: bool = True, PI_range: float = 0.7)[source]#

Predict the optimizer’s target(s) at the candidate set X

abstract save_state()[source]#

Save the optimizer to a state dictionary

abstract suggest()[source]#

Suggest the next optimal experiment(s)