Skip to content

Commit

Permalink
Provide more informative warning messages in InputDataWarning (face…
Browse files Browse the repository at this point in the history
…book#2713)

Summary:
Pull Request resolved: facebook#2713

X-link: pytorch/botorch#2489

Provide more informative warning messages when `InputDataWarning`s are raised to specify whether it pertains to input features or output targets.

Updated unit tests accordingly to ensure coverage.

Differential Revision: D61797434
  • Loading branch information
ltiao authored and facebook-github-bot committed Aug 28, 2024
1 parent 5ef2c61 commit 89d5a34
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ax/modelbridge/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ def cross_validate(
# users with this warning, we filter it out.
warnings.filterwarnings(
"ignore",
message="Data is not standardized",
message=r"Data \(outcome observations\) not standardized",
category=InputDataWarning,
)
cv_predictions = self._cross_validate(
Expand Down
2 changes: 1 addition & 1 deletion ax/modelbridge/cross_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def cross_validate(
# To avoid confusing users with this warning, we filter it out.
warnings.filterwarnings(
"ignore",
message="Data is not standardized",
message=r"Data \(outcome observations\) not standardized",
category=InputDataWarning,
)
cv_test_predictions = model._cross_validate(
Expand Down
2 changes: 1 addition & 1 deletion ax/modelbridge/tests/test_base_modelbridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def warn_and_return_mock_obs(
nonlocal called
called = True
warnings.warn(
"Data is not standardized",
"Data (outcome observations) not standardized",
InputDataWarning,
stacklevel=2,
)
Expand Down

0 comments on commit 89d5a34

Please sign in to comment.