diff --git a/botorch/acquisition/input_constructors.py b/botorch/acquisition/input_constructors.py index f4ac50fd9c..49deb81512 100644 --- a/botorch/acquisition/input_constructors.py +++ b/botorch/acquisition/input_constructors.py @@ -482,7 +482,7 @@ def construct_inputs_qEI( are considered satisfied if the output is less than zero. eta: Temperature parameter(s) governing the smoothness of the sigmoid approximation to the constraint indicators. For more details, on this - parameter, see the docs of `compute_smoothed_constraint_indicator`. + parameter, see the docs of `compute_smoothed_feasibility_indicator`. ignored: Not used. Returns: @@ -548,7 +548,7 @@ def construct_inputs_qNEI( are considered satisfied if the output is less than zero. eta: Temperature parameter(s) governing the smoothness of the sigmoid approximation to the constraint indicators. For more details, on this - parameter, see the docs of `compute_smoothed_constraint_indicator`. + parameter, see the docs of `compute_smoothed_feasibility_indicator`. ignored: Not used. Returns: @@ -620,7 +620,7 @@ def construct_inputs_qPI( are considered satisfied if the output is less than zero. eta: Temperature parameter(s) governing the smoothness of the sigmoid approximation to the constraint indicators. For more details, on this - parameter, see the docs of `compute_smoothed_constraint_indicator`. + parameter, see the docs of `compute_smoothed_feasibility_indicator`. ignored: Not used. Returns: diff --git a/botorch/acquisition/monte_carlo.py b/botorch/acquisition/monte_carlo.py index c366fdcb0d..0b07c4d852 100644 --- a/botorch/acquisition/monte_carlo.py +++ b/botorch/acquisition/monte_carlo.py @@ -42,7 +42,7 @@ from botorch.exceptions.errors import UnsupportedError from botorch.models.model import Model from botorch.sampling.base import MCSampler -from botorch.utils.objective import compute_smoothed_constraint_indicator +from botorch.utils.objective import compute_smoothed_feasibility_indicator from botorch.utils.transforms import ( concatenate_pending_points, match_batch_shape, @@ -215,7 +215,7 @@ def __init__( acquistion utilities, e.g. all improvement-based acquisition functions. eta: Temperature parameter(s) governing the smoothness of the sigmoid approximation to the constraint indicators. For more details, on this - parameter, see the docs of `compute_smoothed_constraint_indicator`. + parameter, see the docs of `compute_smoothed_feasibility_indicator`. """ if constraints is not None and isinstance(objective, ConstrainedMCObjective): raise ValueError( @@ -305,7 +305,7 @@ def _apply_constraints(self, acqval: Tensor, samples: Tensor) -> Tensor: "Constraint-weighting requires unconstrained " "acquisition values to be non-negative." ) - acqval = acqval * compute_smoothed_constraint_indicator( + acqval = acqval * compute_smoothed_feasibility_indicator( constraints=self._constraints, samples=samples, eta=self._eta ) return acqval @@ -366,7 +366,7 @@ def __init__( are considered satisfied if the output is less than zero. eta: Temperature parameter(s) governing the smoothness of the sigmoid approximation to the constraint indicators. For more details, on this - parameter, see the docs of `compute_smoothed_constraint_indicator`. + parameter, see the docs of `compute_smoothed_feasibility_indicator`. """ super().__init__( model=model, @@ -457,7 +457,7 @@ def __init__( are considered satisfied if the output is less than zero. eta: Temperature parameter(s) governing the smoothness of the sigmoid approximation to the constraint indicators. For more details, on this - parameter, see the docs of `compute_smoothed_constraint_indicator`. + parameter, see the docs of `compute_smoothed_feasibility_indicator`. TODO: similar to qNEHVI, when we are using sequential greedy candidate selection, we could incorporate pending points X_baseline and compute @@ -671,7 +671,7 @@ def __init__( scalar is less than zero. eta: Temperature parameter(s) governing the smoothness of the sigmoid approximation to the constraint indicators. For more details, on this - parameter, see the docs of `compute_smoothed_constraint_indicator`. + parameter, see the docs of `compute_smoothed_feasibility_indicator`. """ super().__init__( model=model, diff --git a/botorch/acquisition/multi_objective/monte_carlo.py b/botorch/acquisition/multi_objective/monte_carlo.py index 8c4e857c1b..36e119fcae 100644 --- a/botorch/acquisition/multi_objective/monte_carlo.py +++ b/botorch/acquisition/multi_objective/monte_carlo.py @@ -57,7 +57,7 @@ from botorch.utils.multi_objective.box_decompositions.utils import ( _pad_batch_pareto_frontier, ) -from botorch.utils.objective import compute_smoothed_constraint_indicator +from botorch.utils.objective import compute_smoothed_feasibility_indicator from botorch.utils.torch import BufferDict from botorch.utils.transforms import ( concatenate_pending_points, @@ -279,7 +279,7 @@ def _compute_qehvi(self, samples: Tensor, X: Optional[Tensor] = None) -> Tensor: obj = self.objective(samples, X=X) q = obj.shape[-2] if self.constraints is not None: - feas_weights = compute_smoothed_constraint_indicator( + feas_weights = compute_smoothed_feasibility_indicator( constraints=self.constraints, samples=samples, eta=self.eta ) # `sample_shape x batch-shape x q` self._cache_q_subset_indices(q_out=q) @@ -414,7 +414,7 @@ def __init__( tensor the length of the tensor must match the number of provided constraints. The i-th constraint is then estimated with the i-th eta value. For more details, on this parameter, see the docs of - `compute_smoothed_constraint_indicator`. + `compute_smoothed_feasibility_indicator`. prune_baseline: If True, remove points in `X_baseline` that are highly unlikely to be the pareto optimal and better than the reference point. This can significantly improve computation time and diff --git a/botorch/utils/objective.py b/botorch/utils/objective.py index 5e8db010e5..d8034d49eb 100644 --- a/botorch/utils/objective.py +++ b/botorch/utils/objective.py @@ -87,7 +87,7 @@ def apply_constraints_nonnegative_soft( Returns: A `n_samples x b x q (x m')`-dim tensor of feasibility-weighted objectives. """ - w = compute_smoothed_constraint_indicator( + w = compute_smoothed_feasibility_indicator( constraints=constraints, samples=samples, eta=eta ) if obj.dim() == samples.dim(): @@ -116,7 +116,7 @@ def compute_feasibility_indicator( return ind -def compute_smoothed_constraint_indicator( +def compute_smoothed_feasibility_indicator( constraints: List[Callable[[Tensor], Tensor]], samples: Tensor, eta: Union[Tensor, float], diff --git a/test/utils/test_objective.py b/test/utils/test_objective.py index ee35bf08e5..c7000b712f 100644 --- a/test/utils/test_objective.py +++ b/test/utils/test_objective.py @@ -9,7 +9,7 @@ from botorch.utils import apply_constraints, get_objective_weights_transform from botorch.utils.objective import ( compute_feasibility_indicator, - compute_smoothed_constraint_indicator, + compute_smoothed_feasibility_indicator, ) from botorch.utils.testing import BotorchTestCase from torch import Tensor @@ -196,14 +196,14 @@ def test_constraint_indicators(self): self.assertAllClose(ind, torch.zeros_like(ind)) self.assertEqual(ind.dtype, torch.bool) - smoothed_ind = compute_smoothed_constraint_indicator( + smoothed_ind = compute_smoothed_feasibility_indicator( constraints=[zeros_f], samples=samples, eta=1e-3 ) self.assertAllClose(smoothed_ind, ones_f(samples) / 2) # two constraints samples = torch.randn(1) - smoothed_ind = compute_smoothed_constraint_indicator( + smoothed_ind = compute_smoothed_feasibility_indicator( constraints=[zeros_f, zeros_f], samples=samples, eta=1e-3, @@ -218,13 +218,13 @@ def test_constraint_indicators(self): ) self.assertAllClose(ind, torch.ones_like(ind)) - smoothed_ind = compute_smoothed_constraint_indicator( + smoothed_ind = compute_smoothed_feasibility_indicator( constraints=[minus_one_f], samples=samples, eta=1e-3 ) self.assertTrue((smoothed_ind > 3 / 4).all()) with self.assertRaisesRegex(ValueError, "Number of provided constraints"): - compute_smoothed_constraint_indicator( + compute_smoothed_feasibility_indicator( constraints=[zeros_f, zeros_f], samples=samples, eta=torch.tensor([0.1], device=self.device),