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

Fix np.float and np.float32 to float. #1257

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pytorch_forecasting/data/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def _set_parameters(
if isinstance(y_center, torch.Tensor):
eps = torch.finfo(y_center.dtype).eps
else:
eps = np.finfo(np.float).eps
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32 or 64 bits? Why not y_center.dtype?

eps = np.finfo(np.float32).eps
if self.method == "identity":
if isinstance(y_center, torch.Tensor):
self.center_ = torch.zeros(y_center.size()[:-1])
Expand Down Expand Up @@ -785,7 +785,7 @@ def fit(self, y: pd.Series, X: pd.DataFrame):
self
"""
y = self.preprocess(y)
eps = np.finfo(np.float).eps
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32 or 64 bits? We cannot use y.dtype because it is possible to have different type for y and X.

eps = np.finfo(np.float32).eps
if len(self.groups) == 0:
assert not self.scale_by_group, "No groups are defined, i.e. `scale_by_group=[]`"
if self.method == "standard":
Expand Down