Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions botorch/acquisition/input_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
from botorch.acquisition.objective import (
ConstrainedMCObjective,
IdentityMCObjective,
LearnedObjective,
MCAcquisitionObjective,
PosteriorTransform,
)
Expand All @@ -98,7 +99,7 @@
)
from botorch.exceptions.errors import UnsupportedError
from botorch.models.cost import AffineFidelityCostModel
from botorch.models.deterministic import DeterministicModel, FixedSingleSampleModel
from botorch.models.deterministic import FixedSingleSampleModel
from botorch.models.gpytorch import GPyTorchModel
from botorch.models.model import Model
from botorch.optim.optimize import optimize_acqf
Expand Down Expand Up @@ -214,14 +215,15 @@ def allow_only_specific_variable_kwargs(f: Callable[..., T]) -> Callable[..., T]
in the signature of `f`. Any other keyword arguments will raise an error.
"""
allowed = {
# `training_data` and/or `X_baseline` are needed to compute baselines
# for some EI-type acquisition functions.
"training_data",
"objective",
"posterior_transform",
"X_baseline",
"X_pending",
# Objective thresholds are needed for defining hypervolumes in
# multi-objective optimization.
"objective_thresholds",
"constraints",
"target_fidelities",
# Used in input constructors for some lookahead acquisition functions
# such as qKnowledgeGradient.
"bounds",
}

Expand Down Expand Up @@ -860,7 +862,6 @@ def construct_inputs_EHVI(
model: Model,
training_data: MaybeDict[SupervisedDataset],
objective_thresholds: Tensor,
objective: Optional[MCMultiOutputObjective] = None,
posterior_transform: Optional[PosteriorTransform] = None,
constraints: Optional[List[Callable[[Tensor], Tensor]]] = None,
alpha: Optional[float] = None,
Expand Down Expand Up @@ -1327,12 +1328,7 @@ def construct_inputs_qMFMES(
training_data: MaybeDict[SupervisedDataset],
bounds: List[Tuple[float, float]],
target_fidelities: Dict[int, Union[int, float]],
objective: Optional[MCAcquisitionObjective] = None,
posterior_transform: Optional[PosteriorTransform] = None,
num_fantasies: int = 64,
X_baseline: Optional[Tensor] = None,
X_pending: Optional[Tensor] = None,
objective_thresholds: Optional[Tensor] = None,
fidelity_weights: Optional[Dict[int, float]] = None,
cost_intercept: float = 1.0,
num_trace_observations: int = 0,
Expand Down Expand Up @@ -1364,6 +1360,8 @@ def construct_inputs_analytic_eubo(
pref_model: Optional[Model] = None,
previous_winner: Optional[Tensor] = None,
sample_multiplier: Optional[float] = 1.0,
objective: Optional[LearnedObjective] = None,
posterior_transform: Optional[PosteriorTransform] = None,
) -> Dict[str, Any]:
r"""Construct kwargs for the `AnalyticExpectedUtilityOfBestOption` constructor.

Expand All @@ -1384,6 +1382,11 @@ def construct_inputs_analytic_eubo(
BOPE; if None, we are doing PBO and model is the preference model.
previous_winner: The previous winner of the best option.
sample_multiplier: The scale factor for the single-sample model.
objective: Ignored. This argument is allowed to be passed then ignored
because of the way that EUBO is typically used in a BOPE loop.
posterior_transform: Ignored. This argument is allowed to be passed then
ignored because of the way that EUBO is typically used in a BOPE
loop.

Returns:
A dict mapping kwarg names of the constructor to values.
Expand Down Expand Up @@ -1414,7 +1417,6 @@ def construct_inputs_analytic_eubo(
def construct_inputs_qeubo(
model: Model,
pref_model: Optional[Model] = None,
outcome_model: Optional[DeterministicModel] = None,
sample_multiplier: Optional[float] = 1.0,
sampler: Optional[MCSampler] = None,
objective: Optional[MCAcquisitionObjective] = None,
Expand Down
2 changes: 0 additions & 2 deletions test/acquisition/test_input_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,6 @@ def test_construct_inputs_mfmes(self) -> None:
constructor_args = {
"model": None,
"training_data": self.blockX_blockY,
"objective": None,
"bounds": self.bounds,
"candidate_size": 17,
"target_fidelities": target_fidelities,
Expand Down Expand Up @@ -1340,7 +1339,6 @@ def test_construct_inputs_jes(self) -> None:
kwargs = func(
model=model,
training_data=self.blockX_blockY,
objective=LinearMCObjective(torch.rand(2)),
bounds=self.bounds,
num_optima=17,
maximize=False,
Expand Down
2 changes: 1 addition & 1 deletion tutorials/custom_acquisition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@
" model: Model,\n",
" beta: float,\n",
" weights: List[float],\n",
" **kwargs: Any,\n",
" posterior_transform: None,\n",
") -> Dict[str, Any]:\n",
" return {\n",
" \"model\": model,\n",
Expand Down