Optimizer#

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

__init__(X_space: ParamSpace, seed: int | None = None, verbose: int = 1)[source]#

Methods

__init__(X_space[, seed, verbose])

fit(Z, target)

Fit the optimizer's surrogate models to data

hypervolume(f[, ref_point, weights])

Calculates the hypervolume of the given data points.

load_state(obj_dict)

Load the optimizer from a state dictionary

maximize()

Maximize the optimizer's target(s)

pareto(f)

Determines the Pareto dominance of a given set of solutions.

pf_distance(y)

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

predict(X[, return_f_inv, PI_range])

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

save_state()

Save the optimizer to a state dictionary

set_X_space(X_space)

suggest()

Suggest the next optimal experiment(s)

Attributes

X_space

The parameter space defining the search space for the optimization.

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)