Skip to content

Commit fa51038

Browse files
esantorellafacebook-github-bot
authored andcommitted
Expanded on docstrings related to sampling in acquisition functions (#2010)
Summary: ## Motivation I did this mainly for my own understanding. ### Have you read the [Contributing Guidelines on pull requests](https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md#pull-requests)? Yes Pull Request resolved: #2010 Test Plan: Human review Reviewed By: Balandat Differential Revision: D49120984 Pulled By: esantorella fbshipit-source-id: d9ad0df21e34d9d46c20eefeac720d00a944b823
1 parent cd5c51e commit fa51038

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

botorch/acquisition/acquisition.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ def __init__(self, sampler: Optional[MCSampler] = None) -> None:
124124
125125
Args:
126126
sampler: The sampler used to draw base samples for MC-based acquisition
127-
functions. If `None`, a sampler is generated using `get_sampler`.
127+
functions. If `None`, a sampler is generated on the fly within
128+
the `get_posterior_samples` method using `get_sampler`.
128129
"""
129130
self.sampler = sampler
130131

botorch/acquisition/monte_carlo.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ def __init__(
7070
Args:
7171
model: A fitted model.
7272
sampler: The sampler used to draw base samples. If not given,
73-
a sampler is generated using `get_sampler`.
73+
a sampler is generated on the fly within the
74+
`get_posterior_samples` method using
75+
`botorch.sampling.get_sampler`.
7476
NOTE: For posteriors that do not support base samples,
7577
a sampler compatible with intended use case must be provided.
7678
See `ForkedRNGSampler` and `StochasticSampler` as examples.
@@ -189,8 +191,10 @@ def __init__(
189191
190192
Args:
191193
model: A fitted model.
192-
sampler: The sampler used to draw base samples. If not given,
193-
a sampler is generated using `get_sampler`.
194+
sampler: The sampler used to draw base samples. If not given, a
195+
sampler is generated on the fly within the
196+
`get_posterior_samples` method using
197+
`botorch.sampling.get_sampler`.
194198
NOTE: For posteriors that do not support base samples,
195199
a sampler compatible with intended use case must be provided.
196200
See `ForkedRNGSampler` and `StochasticSampler` as examples.
@@ -557,7 +561,7 @@ def compute_best_f(self, obj: Tensor) -> Tensor:
557561
return val.view(view_shape).to(obj)
558562

559563
def _sample_forward(self, obj: Tensor) -> Tensor:
560-
r"""Evaluate qNoisyExpectedImprovement per sample on the candidate set `X`.
564+
"""Evaluate qNoisyExpectedImprovement per objective value in `obj`.
561565
562566
Args:
563567
obj: A `sample_shape x batch_shape x q`-dim Tensor of MC objective values.

botorch/optim/optimize.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ def _optimize_acqf_sequential_q(
217217
) -> Tuple[Tensor, Tensor]:
218218
"""
219219
Helper function for `optimize_acqf` when sequential=True and q > 1.
220+
221+
For each of `q` times, generate a single candidate greedily, then add it to
222+
the list of pending points.
220223
"""
221224
_validate_sequential_inputs(opt_inputs)
222225
# When using sequential optimization, we allocate the total timeout

0 commit comments

Comments
 (0)