Skip to content

Acquisition

Acquisition functions for each backend.

botorch_acquisition

BoTorchAcquisition

BoTorchAcquisition(search_space, model=None, acq_func='ucb', maximize=True, random_state=42, acq_func_kwargs=None, batch_size=1, ref_point=None, directions=None, objective_names=None, outcome_constraints=None)

Bases: BaseAcquisition

Acquisition function implementation using BoTorch.

Supported acquisition functions: - 'ei': Expected Improvement - 'logei': Log Expected Improvement (numerically stable) - 'pi': Probability of Improvement - 'logpi': Log Probability of Improvement (numerically stable) - 'ucb': Upper Confidence Bound - 'qei': Batch Expected Improvement (for q>1) - 'qucb': Batch Upper Confidence Bound (for q>1) - 'qipv' or 'qnipv': q-Negative Integrated Posterior Variance (exploratory)

Initialize the BoTorch acquisition function.

Parameters:

Name Type Description Default
search_space

The search space (SearchSpace object)

required
model

A trained model (BoTorchModel)

None
acq_func

Acquisition function type (see class docstring for options)

'ucb'
maximize

Whether to maximize (True) or minimize (False) the objective

True
random_state

Random state for reproducibility

42
acq_func_kwargs

Dictionary of additional arguments for the acquisition function

None
batch_size

Number of points to select at once (q)

1
ref_point

Reference point for MOBO hypervolume (list of floats)

None
directions

Per-objective direction list ('maximize'/'minimize')

None
objective_names

List of objective names (for multi-objective)

None
outcome_constraints

List of outcome constraint callables for MOBO

None

Raises:

Type Description
ValueError

If acq_func is not a valid acquisition function name

update_model

update_model(model)

Update the underlying model.

select_next

select_next(candidate_points=None, context_values=None, hold=None, observed_values=None)

Suggest the next experiment point(s) using BoTorch optimization.

Parameters:

Name Type Description Default
candidate_points

Candidate points to evaluate (optional). Cannot be combined with hold: evaluating given candidates never moves a variable, so a held value would be silently ignored. Passing both raises ValueError.

None
context_values

Older name for observed_values.

None
hold

Dict of controllable variable name -> value to keep fixed for this call. The returned point carries the held values.

None
observed_values

Dict of observed variable name -> measured value. Required when observed variables are registered.

None

Returns:

Type Description

Dictionary with the selected point or list of points

update

update(X=None, y=None)

Update the acquisition function with new observations.

Parameters:

Name Type Description Default
X

Features of new observations

None
y

Target values of new observations

None

find_optimum

find_optimum(model=None, maximize=None, random_state=None)

Find the point where the model predicts the optimal value.

This uses the same approach as regret plot predictions: generate a grid in the original variable space, predict using the model's standard pipeline, and find the argmax/argmin. This ensures categorical variables are handled correctly through proper encoding/decoding.

skopt_acquisition

SkoptAcquisition

SkoptAcquisition(search_space, model=None, acq_func='ei', maximize=True, random_state=42, acq_func_kwargs=None)

Bases: BaseAcquisition

Simple acquisition function implementation using scikit-optimize (skopt).

Supported acquisition functions: - 'ei' or 'EI': Expected Improvement - 'pi' or 'PI': Probability of Improvement
- 'ucb' or 'UCB': Upper Confidence Bound (mapped to LCB in skopt) - 'gp_hedge': GP-Hedge (portfolio of acquisition functions)

Initialize the acquisition function.

Parameters:

Name Type Description Default
search_space

The search space (SearchSpace object or list of skopt dimensions)

required
model

A trained model (SklearnModel or compatible)

None
acq_func

Acquisition function ('ei', 'pi', 'ucb', or 'gp_hedge')

'ei'
maximize

Whether to maximize (True) or minimize (False) the objective

True
random_state

Random state for reproducibility

42
acq_func_kwargs

Dictionary of additional arguments for the acquisition function

None

Raises:

Type Description
ValueError

If acq_func is not a valid acquisition function name

update

update(X, y, **kwargs)

Update the optimizer with new observations.

select_next

select_next(candidate_points=None, **kwargs)

Suggest the next experiment point.

find_optimum

find_optimum(model, maximize=True, random_state=42)

Find the point where the model predicts the optimal value.

Parameters:

Name Type Description Default
model

Trained model with predict method

required
maximize

Whether to maximize (True) or minimize (False) the objective

True
random_state

Random seed for reproducibility

42

Returns:

Name Type Description
dict

Contains 'x_opt' (optimal point), 'value' (predicted value), 'std' (standard deviation at optimum)