-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
input_transform Normalize does not seem to work properly with condition_on_observations #1435
Comments
Hmm interesting it might be that some of the input transformations may not play well with the |
I assume this works fine if you don't use an input transform? |
@Balandat that is correct. In fact, it actually works with the |
The issue seems to be that the This will be fixed in #1372, as it gets rid of the |
@saitcakmak thank you, I'll give your hack a try for now! |
@saitcakmak so just to be clear as to what you mean here. The idea would be to create an entirely new model with all of the same required objects (e.g. the transforms) but with the new training data (in my case a Thanks! Edit: never mind, what I just asked about does appear to work regardless! |
Yep, just repeat |
@saitcakmak the problem though is that when initializing using what you show above, the correct hyper parameters are set for the transforms, but not the length scales. When you do Not entirely sure how to fix this on my end, seems pretty complicated since the TL;DR, can I set the model length scales without overwriting the transform parameters, without recalling train? Also, an aside, does calling |
If you do
It will update all buffers & parameters of the GP and its submodules with the corresponding values from the
The above bit should work for this. Though, if you don't want to retrain / call
Yes, for the first model training attempt, it should use the model parameters as the initial values. If the first attempt fails and it has to retry, then it will randomly sample from the priors. Intuitively, this should speed things up. |
@saitcakmak Your suggestion does work, but I'd like to bring another set of weird behaviors to your attention: print(train_x)
"""
tensor([[0.0000],
[0.7143],
[1.4286],
[2.1429],
[2.8571]])
"""
print(train_y)
"""
tensor([-1.6720, 45.1938, 72.6386, 93.8865, 79.5389])
"""
model = botorch.models.SingleTaskGP(
train_X=train_x,
train_Y=train_y,
input_transform=Normalize(1),
outcome_transform=Standardize(1)
)
model.train_inputs[0]
"""
tensor([[0.0000],
[0.7143],
[1.4286],
[2.1429],
[2.8571]])
"""
model.train_targets
"""
tensor([-1.5798, -0.3373, 0.3903, 0.9536, 0.5732])
""" For some reason, the inputs are not being scaled immediately like the targets. This is making retrieving the current model's training data from the model itself really challenging, especially after reconditioning. Any thoughts? EDIT: I think I've nailed down the source of this. Looks like the training data inputs behavior changes with whether or not |
Looks like you figured out. We transform the outcomes before passing them to GPyTorch, so |
Ahh so that's what |
@saitcakmak funny that I come back to this exactly a year later. Have there been any updates on merging #1372? 😁 Looks like the GPyTorch side of the changes is ready to merge but just never was. Thanks! |
Hi @matthewcarbone , refactoring input transforms is still in progress. #1372 can't be merged in as-is since there are a good number of other changes that need to be made to ensure that such a large change works smoothly. |
@esantorella ok no problem. I'm happy to help contribute somehow if there's any opportunity. Thanks! 👍 |
🐛 Bug
After running
model.condition_on_observations(new_x, new_y)
, where the original model was instantiated withNormalize(d)
, that model fails during retraining. I believe this is a bug but I'm honestly not sure.To reproduce
Step 1: initialize dummy data
Step 2: initialization/training, works just fine
Step 3: condition
Step 4: attempt retraining to further tune hyper parameters/length scales and whatnot
Stack trace/error message
Expected Behavior
I think the second training procedure is supposed to work, right? It would seem sensible that
Normalize
would be updated with the new training information as passed during conditioning.System information
BoTorch version:
0.7.2
GPyTorch version:
1.9.0
Torch version:
1.12.0
Computer OS: Mac M1 Max OS version
12.5.1
The text was updated successfully, but these errors were encountered: