Skip to content

Commit

Permalink
numpy 2.0 replacing deprecated namespace (#2553)
Browse files Browse the repository at this point in the history
Co-authored-by: madtoinou <[email protected]>
Co-authored-by: Dennis Bader <[email protected]>
  • Loading branch information
3 people authored Nov 14, 2024
1 parent d60ef87 commit bb24999
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
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

0 comments on commit bb24999

Please sign in to comment.