baybe.recommenders.pure.bayesian.botorch.continuous.recommend_continuous_with_cardinality_constraints

baybe.recommenders.pure.bayesian.botorch.continuous.recommend_continuous_with_cardinality_constraints(recommender: BotorchRecommender, subspace_continuous: SubspaceContinuous, batch_size: int)[source]

Recommend from a continuous space with cardinality constraints.

Optimizes the acquisition function across subsets defined by cardinality constraints and returns the best result.

The specific collection of subsets considered by the recommender is obtained as either the full combinatorial set of possible parameter splits or a random selection thereof, depending on the upper bound specified by the corresponding recommender attribute.

In each subset, the constraint-imposed configuration is fixed, so that the constraints can be removed and a regular optimization can be performed. The recommendation is then constructed from the combined optimization results of the unconstrained spaces.

Parameters:
  • recommender (BotorchRecommender) – The recommender instance.

  • subspace_continuous (SubspaceContinuous) – The continuous subspace from which to generate recommendations.

  • batch_size (int) – The size of the recommendation batch.

Return type:

tuple[Tensor, Tensor]

Returns:

The recommendations and corresponding acquisition values.

Raises:

ValueError – If the continuous search space has no cardinality constraints.