Skip to content

Commit

Permalink
Move inversion step to right context
Browse files Browse the repository at this point in the history
Not all MC acquisitions functions use best_f (e.g. qUCB), causing a
KeyError in these cases
  • Loading branch information
AdrianSosic committed Jan 22, 2025
1 parent 1fd11f5 commit 4fdd687
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions baybe/acquisition/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@ def to_botorch(
additional_params["best_f"] = (
bo_surrogate.posterior(train_x).mean.min().item()
)
if self.is_mc:
additional_params["best_f"] *= -1.0

if issubclass(acqf_cls, bo_acqf.AnalyticAcquisitionFunction):
additional_params["maximize"] = False
elif issubclass(acqf_cls, bo_acqf.MCAcquisitionFunction):
additional_params["best_f"] *= -1.0
elif self.is_mc:
additional_params["objective"] = LinearMCObjective(
torch.tensor([-1.0])
)
Expand Down

0 comments on commit 4fdd687

Please sign in to comment.