base#
Optimizer class definition
Classes
|
Base class for obsidian optimizer, which fits a surrogate model to data and suggests optimal experiments |
- class obsidian.optimizer.base.Optimizer(X_space: ParamSpace, task: TaskType | str = TaskType.OPTIMIZATION, seed: int | None = None, rng: RNGManager | None = None, fix_random_state: bool = True, verbose: int = 1)[source]#
Bases:
ABCBase 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:
- 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:
- fit(Z: DataFrame, target: Target | list[Target], manual_seed: int | None = None, fit_options: dict | None = None)[source]#
Fit surrogate model(s) using observed data.
This is a wrapper around
_fit()that handles RNG behavior for backward compatibility: - Ifobsidian.USE_OLD_RNG_CONTROLisTrue, calls_fitdirectly. - Otherwise, temporarily appliesmanual_seedviatmp_seed_overrideandthen calls
_fit.- Parameters:
Z (pd.DataFrame) – Observation table containing input variables and measured target values used for training.
target (Target | list[Target]) – One target or a list of targets to fit.
manual_seed (int | None, optional) – Temporary seed used only for this fit call when new RNG control is enabled. If
None, a seed is sampled from the optimizer’s model_generator. Defaults toNone.fit_options (dict, optional) – Extra options forwarded to model.fit(). Refer to model’s
fitmethod for supported options. Defaults to an empty dictionary.
- Returns:
Fit the surrogate model(s) in-place.
- Return type:
None
- 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.
- 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