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.
recommend
(searchspace[, batch_size, ...])Recommend a batch of points from the given search space.
setup_acquisition_function
(searchspace[, ...])Create the current acquisition function from provided training data.
Public attributes and properties
The used surrogate model.
The used acquisition function class.
Allow to make recommendations that were measured previously.
Allow to make recommendations that were already recommended earlier.
Class variable reflecting the search space compatibility.
- __init__(surrogate_model: Surrogate = NOTHING, acquisition_function_cls: Literal['PM', 'PI', 'EI', 'UCB', 'qPI', 'qEI', 'qUCB', 'VarUCB', 'qVarUCB'] = 'qEI', *, allow_repeated_recommendations: bool = False, allow_recommending_already_measured: bool = True)¶
Method generated by attrs for class BayesianRecommender.
For details on the parameters, see Public attributes and properties.
- recommend(searchspace: SearchSpace, batch_size: int = 1, train_x: DataFrame | None = None, train_y: DataFrame | None = None)[source]¶
Recommend a batch of points from the given search space.
- Parameters:
- Return type:
- Returns:
A dataframe containing the recommendations as individual rows.
- setup_acquisition_function(searchspace: SearchSpace, train_x: DataFrame | None = None, train_y: DataFrame | None = None)[source]¶
Create the current acquisition function from provided training data.
The acquisition function is stored in the private attribute
_acquisition_function
.- Parameters:
searchspace (
SearchSpace
) – The search space in which the experiments are to be conducted.train_x (
Optional
[DataFrame
]) – The features of the conducted experiments.train_y (
Optional
[DataFrame
]) – The corresponding response values.
- Raises:
NotImplementedError – If the setup is attempted from empty training data
- Return type:
-
acquisition_function_cls:
Literal
['PM'
,'PI'
,'EI'
,'UCB'
,'qPI'
,'qEI'
,'qUCB'
,'VarUCB'
,'qVarUCB'
]¶ The used acquisition function class.
- allow_recommending_already_measured: bool¶
Allow to make recommendations that were measured previously. This only has an influence in discrete search spaces.
- allow_repeated_recommendations: bool¶
Allow to make recommendations that were already recommended earlier. This only has an influence in discrete search spaces.
- compatibility: ClassVar[SearchSpaceType]¶
Class variable reflecting the search space compatibility.