botorch icon indicating copy to clipboard operation
botorch copied to clipboard

[Bug] SingleTaskVariationalGP raises a warning when using input_transform

Open crasanders opened this issue 1 year ago • 4 comments

🐛 Bug

Calling SingleTaskVariationalGP.posterior with an input_transform raises a warning, whereas the equivalent call with SingleTaskGP does not. I'm not sure if input_transform works correctly with SingleTaskVariationalGP or if I can safely interpret the resulting posterior. It also seems a little odd to me that this would be a warning and not an exception.

To reproduce

** Code snippet to reproduce **

import torch
from botorch.models import SingleTaskGP, SingleTaskVariationalGP
from botorch.models.transforms import Normalize

X = torch.rand((20, 1))
y = torch.sin(X)

model = SingleTaskGP(train_X=X, train_Y=y, input_transform=Normalize(1))
post = model.posterior(X) # No warning

model = SingleTaskVariationalGP(train_X=X, train_Y=y, input_transform=Normalize(1))
post = model.posterior(X) # Warning

** Stack trace/error message **

RuntimeWarning: Could not update `train_inputs` with transformed inputs since SingleTaskVariationalGP does not have a `train_inputs` attribute. Make sure that the `input_transform` is applied to both the train inputs and test inputs.```

System information

botorch version = 0.8.5 gpytorch version = 1.10 torch version = 1.13.1

crasanders avatar May 10 '23 22:05 crasanders