Skip to content
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

[Feature Request] InputDataWarnings are are confusing #1847

Open
esantorella opened this issue May 30, 2023 · 4 comments
Open

[Feature Request] InputDataWarnings are are confusing #1847

esantorella opened this issue May 30, 2023 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@esantorella
Copy link
Member

Motivation

It's common to see warnings like this:

import torch
from botorch.models import SingleTaskGP

x = torch.linspace(-5, 10, 100).unsqueeze(-1)
model = SingleTaskGP(train_X=x, train_Y=x)
/botorch/models/utils/assorted.py:173: InputDataWarning:

Input data is not contained to the unit cube. Please consider min-max scaling the input data.

/botorch/models/utils/assorted.py:201: InputDataWarning:

Input data is not standardized. Please consider scaling the input to zero mean and unit variance.

Pitch

To improve these warnings,

  • Make it clear which of these is about train_X and which is about train_Y. (Should the y data be "outcome" data?)
  • Suggest using transforms to fix this. In this case, a better implementation would be
import torch
from botorch.models import SingleTaskGP
from botorch.models.transforms.input import Normalize
from botorch.models.transforms.outcome import Standardize


x = torch.linspace(-5, 10, 100).unsqueeze(-1)
model = SingleTaskGP(
    train_X=x,
    train_Y=x,
    input_transform=Normalize(d=1),
    outcome_transform=Standardize(m=1)
)

Are you willing to open a pull request? (See CONTRIBUTING)

Yes, but this is pretty easy so it would make a good first task for a newcomer

@esantorella esantorella added enhancement New feature or request good first issue Good for newcomers labels May 30, 2023
@aditigode
Copy link

Hi,
I am newcomer, can I take this?

@Balandat
Copy link
Contributor

Hi, I am newcomer, can I take this?

Most certainly, thanks! Let us know if you need any help, but most of what you need should be here: https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md

@esantorella
Copy link
Member Author

Hi, I am newcomer, can I take this?

Definitely! The one thing that may be tricky here is that BoTorch requires 100% test coverage and requires all tests to pass; to achieve that, you'll need to update existing tests such as this one. We also suppress the input data warnings in unit tests here, so that may need to be updated too.

@saitcakmak
Copy link
Contributor

We also suppress the input data warnings in unit tests here, so that may need to be updated too.

These warnings can be locally brought back and checked for using something like

with warnings.catch_warnings(record=True) as ws:
    warnings.simplefilter("always")
    function_call_to_produce_the_warning(...)
self.assertTrue(any(expected_warning_msg in str(w) for w in ws))

I'd prefer a local solution like this to bringing them back for all of the test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants