Skip to content

Commit

Permalink
Adding central moments to standardization warning (pytorch#1914)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#1914

This commit adds the mean and std of the outcome data to the standardization warning.

Reason:

I got a standardization warning even though I passed a `Standardize` transform, which turned out to be caused by an upstream data processing bug that made the output data constant (std = 0). Understanding and resolving this would have been quicker if the warning would have given me the first two central moments right away.

Reviewed By: sdaulton, Balandat

Differential Revision: D47190582

fbshipit-source-id: e1f07f3e79812c4ab999d1ed9d0423a3ff32ba22
  • Loading branch information
SebastianAment authored and facebook-github-bot committed Jul 6, 2023
1 parent 5bf06d7 commit a8438f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions botorch/models/utils/assorted.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ def check_standardization(
Ymean, Ystd = torch.mean(Y, dim=-2), torch.std(Y, dim=-2)
if torch.abs(Ymean).max() > atol_mean or torch.abs(Ystd - 1).max() > atol_std:
msg = (
"Input data is not standardized. Please consider scaling the "
"input to zero mean and unit variance."
f"Input data is not standardized (mean = {Ymean}, std = {Ystd}). "
"Please consider scaling the input to zero mean and unit variance."
)
if raise_on_fail:
raise InputDataError(msg)
Expand Down

0 comments on commit a8438f0

Please sign in to comment.