Skip to content

[Bug]: Input transforms for deterministic models #3071

@jduerholt

Description

@jduerholt

What happened?

When using input transforms in deterministic models, one always gets a RuntimeWarning with the following message: "Could not update train_inputs with transformed inputs since GenericDeterministicModel does not have a train_inputs attribute. Make sure that the input_transform is applied to both the train inputs and test inputs." It stems from

"Could not update `train_inputs` with transformed inputs "

This warning seems to further propagates into gen_candidates_scipy and produces an OptimizationWarning with "Optimization failed" which yields restarts of gen_candidates_scipy and makes it slower.

I would recommend to not raise this warning for deterministic models. Any idea on how to do this?

Please provide a minimal, reproducible example of the unexpected behavior.

from botorch.models.deterministic import AffineDeterministicModel
from botorch.models.transforms.input import FilterFeatures
import torch

deterministic = AffineDeterministicModel(
    a=torch.tensor([[-1.0, 2.0]]),
    b=0.1
)

deterministic.input_transform = FilterFeatures(
    feature_indices=torch.tensor([0, 2], dtype=torch.long)
)

deterministic.eval()

Please paste any relevant traceback/logs produced by the example provided.

BoTorch Version

recent main

Python Version

No response

Operating System

No response

(Optional) Describe any potential fixes you've considered to the issue outlined above.

No response

Pull Request

Yes

Code of Conduct

  • I agree to follow BoTorch's Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions