You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to define a custom q sample shape when instantiating Q acquisition function without knowing the posterior.
Motivation
The MCSamplerMixin allows the use of the get_sampler dispatcher when the posterior is not known at instantiation time, but it defaults to using _default_sample_shape. When the posterior is known beforehand, I can construct the acquisition function with a sampler that provides a custom sample shape. I would like the ability to provide a custom sample shape even if the posterior is not known beforehand.
Pitch
Describe the solution you'd like
Add an optional sample_shape parameter to the MCSamplerMixin constructor, using the default sample shape if not provided. This sample shape can be used when lazily instantiating the sampler with the get_sampler dispatcher in the get_posterior_samples method. This sample_shape parameter can be propagated to MCAcquisitionFunction -> SampleReducingMCAcquisitionFunction -> ...
Describe alternatives you've considered
Overriding the get_posterior_samples method
Overriding the private attribute _default_sample_shape
Are you willing to open a pull request? (See CONTRIBUTING)
Yes
The text was updated successfully, but these errors were encountered:
Hi @julianStreibel. Thanks for opening the issue. That's a very reasonable request, though I don't like the part where we need to add a new kwarg to all MC acquisition functions. IMO, we already have too many rarely used kwargs on many acquisition functions and I'd like to clean that up. One option I was thinking of is to move these kwargs from being acquisition function inputs to a setting file, similar to how it is done in GPyTorch (link). This would let you configure the default sample shape globally without having to add it as an input to the acquisition function constructors. Here's what this could look like:
from botorch.settings import default_sample_shape
with default_sample_shape(single_objective=torch.Size([128])):
acqf = qLogExpectedImprovement(model=model, best_f=1.0)
...
🚀 Feature Request
I would like to define a custom q sample shape when instantiating Q acquisition function without knowing the posterior.
Motivation
The MCSamplerMixin allows the use of the get_sampler dispatcher when the posterior is not known at instantiation time, but it defaults to using _default_sample_shape. When the posterior is known beforehand, I can construct the acquisition function with a sampler that provides a custom sample shape. I would like the ability to provide a custom sample shape even if the posterior is not known beforehand.
Pitch
Describe the solution you'd like
Add an optional sample_shape parameter to the MCSamplerMixin constructor, using the default sample shape if not provided. This sample shape can be used when lazily instantiating the sampler with the get_sampler dispatcher in the get_posterior_samples method. This sample_shape parameter can be propagated to MCAcquisitionFunction -> SampleReducingMCAcquisitionFunction -> ...
Describe alternatives you've considered
Are you willing to open a pull request? (See CONTRIBUTING)
Yes
The text was updated successfully, but these errors were encountered: