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

numpy 2.0 replacing deprecated namespace #2553

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
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 darts/ad/detectors/threshold_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def _detect_core(self, series: TimeSeries, name: str = "series") -> TimeSeries:

def _detect_fn(x, lo, hi):
# x of shape (time,) for 1 component
return (x < (np.NINF if lo is None else lo)) | (
x > (np.Inf if hi is None else hi)
return (x < (-np.inf if lo is None else lo)) | (
x > (np.inf if hi is None else hi)
)

detected = np.zeros_like(np_series, dtype=int)
Expand Down
2 changes: 1 addition & 1 deletion darts/models/forecasting/fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def fit(self, series: TimeSeries):
]

# set all other values in the frequency domain to 0
self.fft_values_filtered = np.zeros(len(self.fft_values), dtype=np.complex_)
self.fft_values_filtered = np.zeros(len(self.fft_values), dtype=np.complex128)
self.fft_values_filtered[self.filtered_indices] = self.fft_values[
self.filtered_indices
]
Expand Down
2 changes: 1 addition & 1 deletion darts/models/forecasting/forecasting_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ def retrain_func(
length=1,
freq=series_.freq,
),
values=np.array([np.NaN]),
values=np.array([np.nan]),
)

forecast = model._predict_wrapper(
Expand Down
2 changes: 1 addition & 1 deletion darts/utils/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _divide_no_nan(a, b):
result = a / b
result[result != result] = 0.0
result[result == np.inf] = 0.0
result[result == np.NINF] = 0.0
result[result == -np.inf] = 0.0
return result


Expand Down
Loading