Skip to content

Commit

Permalink
Provide more informative warning messages in InputDataWarning (#2713)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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.

Reviewed By: Balandat

Differential Revision: D61797434

fbshipit-source-id: 494e5ce0e4713796f1836406d2a89c7138dba667
  • Loading branch information
ltiao authored and facebook-github-bot committed Aug 28, 2024
1 parent 36917bc commit 373fe81
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 373fe81

Please sign in to comment.