BayesianRecommender

class baybe.recommenders.pure.bayesian.base.BayesianRecommender[source]

Bases: PureRecommender, ABC

An abstract class for Bayesian Recommenders.

Public methods

__init__([surrogate_model, ...])

Method generated by attrs for class BayesianRecommender.

acquisition_values(candidates, searchspace, ...)

Compute the acquisition values for the given candidates.

get_acquisition_function(searchspace, ...[, ...])

Get the acquisition function for the given recommendation context.

get_surrogate(searchspace, objective, ...)

Get the trained surrogate model.

joint_acquisition_value(candidates, ...[, ...])

Compute the joint acquisition value for the given candidate batch.

recommend(batch_size, searchspace[, ...])

Recommend a batch of points from the given search space.

Public attributes and properties

acquisition_function

The acquisition function.

allow_recommending_already_measured

Deprecated!

allow_recommending_pending_experiments

Deprecated!

allow_repeated_recommendations

Deprecated!

surrogate_model

Deprecated!

compatibility

Class variable reflecting the search space compatibility.

__init__(surrogate_model: SurrogateProtocol = NOTHING, acquisition_function: AcquisitionFunction | str | None = None, *, allow_repeated_recommendations: bool | None = None, allow_recommending_already_measured: bool | None = None, allow_recommending_pending_experiments: bool | None = None)

Method generated by attrs for class BayesianRecommender.

For details on the parameters, see Public attributes and properties.

acquisition_values(candidates: DataFrame, searchspace: SearchSpace, objective: Objective, measurements: DataFrame, pending_experiments: DataFrame | None = None, acquisition_function: AcquisitionFunction | None = None)[source]

Compute the acquisition values for the given candidates.

Parameters:
Return type:

Series

Returns:

A series of individual acquisition values, one for each candidate.

get_acquisition_function(searchspace: SearchSpace, objective: Objective, measurements: pd.DataFrame, pending_experiments: pd.DataFrame | None = None)[source]

Get the acquisition function for the given recommendation context.

For details on the method arguments, see recommend().

Return type:

BoAcquisitionFunction

get_surrogate(searchspace: SearchSpace, objective: Objective, measurements: DataFrame)[source]

Get the trained surrogate model.

Return type:

SurrogateProtocol

joint_acquisition_value(candidates: DataFrame, searchspace: SearchSpace, objective: Objective, measurements: DataFrame, pending_experiments: DataFrame | None = None, acquisition_function: AcquisitionFunction | None = None)[source]

Compute the joint acquisition value for the given candidate batch.

For details on the method arguments, see acquisition_values().

Return type:

float

Returns:

The joint acquisition value of the batch.

recommend(batch_size: int, searchspace: SearchSpace, objective: Objective | None = None, measurements: DataFrame | None = None, pending_experiments: DataFrame | None = None)[source]

Recommend a batch of points from the given search space.

Parameters:
  • batch_size (int) – The number of points to be recommended.

  • searchspace (SearchSpace) – The search space from which to recommend the points.

  • objective (Optional[Objective]) – An optional objective to be optimized.

  • measurements (Optional[DataFrame]) – Optional experimentation data that can be used for model training. The data is to be provided in “experimental representation”: It needs to contain one column for each parameter spanning the search space (column name matching the parameter name) and one column for each target tracked by the objective (column name matching the target name). Each row corresponds to one conducted experiment, where the parameter columns define the experimental setting and the target columns report the measured outcomes.

  • pending_experiments (Optional[DataFrame]) – Parameter configurations in “experimental representation” specifying experiments that are currently pending.

Return type:

DataFrame

Returns:

A dataframe containing the recommendations in experimental representation as individual rows.

acquisition_function: AcquisitionFunction | None

The acquisition function. When omitted, a default is used.

property allow_recommending_already_measured: NoReturn

Deprecated!

property allow_recommending_pending_experiments: NoReturn

Deprecated!

property allow_repeated_recommendations: NoReturn

Deprecated!

compatibility: ClassVar[SearchSpaceType]

Class variable reflecting the search space compatibility.

property surrogate_model: SurrogateProtocol

Deprecated!