-
Notifications
You must be signed in to change notification settings - Fork 452
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
botorch.posteriors.gpytorch.GPyTorchPosterior.distribution can hold distributions that are not MultivariateNormal, including Beta and Bernoulli distributions, depending on the model likelihood.
For instance with a SingleTaskVariationalGP with BetaLikelihood, the posterior with observation noise has a Beta distribution. Is GPyTorchPosterior meant to work with Beta posterior? If the type hint below is correct, it follows that GPyTorchPosterior would be the incorrect class for a Beta posterior distribution?
botorch/botorch/posteriors/gpytorch.py
Line 38 in 5818db2
| distribution: MultivariateNormal |
Please provide a minimal, reproducible example of the unexpected behavior.
import torch
from botorch.models.approximate_gp import SingleTaskVariationalGP
from gpytorch.distributions import MultivariateNormal
from gpytorch.likelihoods import BetaLikelihood
train_X = torch.rand((20, 10), dtype=torch.double)
train_Y = torch.rand((20, 1), dtype=torch.double)
model = SingleTaskVariationalGP(
train_X,
train_Y,
likelihood=BetaLikelihood(),
)
posterior = model.posterior(train_X, observation_noise=True)
print(f"`posterior` is of type {type(posterior)}")
print(f"Posterior distribution is of type {type(posterior.distribution)}")
print(f"posterior.distribution is an instance of MultivariateNormal: {isinstance(posterior.distribution, MultivariateNormal)}")
Please paste any relevant traceback/logs produced by the example provided.
miniconda3/envs/botorch/lib/python3.12/site-packages/botorch/models/utils/assorted.py:274: InputDataWarning: Data (outcome observations) is not standardized (std = tensor([0.2552], dtype=torch.float64), mean = tensor([0.4533], dtype=torch.float64)).Please consider scaling the input to zero mean and unit variance.
check_standardization(Y=train_Y, raise_on_fail=raise_on_fail)
`posterior` is of type <class 'botorch.posteriors.gpytorch.GPyTorchPosterior'>
Posterior distribution is of type <class 'pyro.distributions.torch.Beta'>
posterior.distribution is an instance of MultivariateNormal: FalseBoTorch Version
0.16.0
Python Version
3.12.12
Operating System
macOS 26.0.1
(Optional) Describe any potential fixes you've considered to the issue outlined above.
Update the type hint
Pull Request
Yes
Code of Conduct
- I agree to follow BoTorch's Code of Conduct
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working