Skip to content

Commit 2562be4

Browse files
committed
fix: replace deprecated scipy.integrate.cumtrapz with cumulative_trapezoid
scipy.integrate.cumulative_trapezoid was introduced in scipy 1.6.0 and scipy.integrate.cumtrapz was removed in scipy 1.14.0 https://scipy.github.io/devdocs/release/1.6.0-notes.html#scipy-integrate-improvements https://scipy.github.io/devdocs/release/1.14.0-notes.html#expired-deprecations
1 parent 5d1497d commit 2562be4

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

gpytorch/kernels/spectral_delta_kernel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def initialize_from_data(self, train_x, train_y):
5252
"""
5353
import numpy as np
5454
from scipy.fftpack import fft
55-
from scipy.integrate import cumtrapz
55+
from scipy.integrate import cumulative_trapezoid
5656

5757
N = train_x.size(-2)
5858
emp_spect = np.abs(fft(train_y.cpu().detach().numpy())) ** 2 / N
@@ -65,7 +65,7 @@ def initialize_from_data(self, train_x, train_y):
6565
emp_spect = emp_spect[: M + 1]
6666

6767
total_area = np.trapz(emp_spect, freq)
68-
spec_cdf = np.hstack((np.zeros(1), cumtrapz(emp_spect, freq)))
68+
spec_cdf = np.hstack((np.zeros(1), cumulative_trapezoid(emp_spect, freq)))
6969
spec_cdf = spec_cdf / total_area
7070

7171
a = np.random.rand(self.raw_Z.size(-2), 1)

gpytorch/kernels/spectral_mixture_kernel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def initialize_from_data_empspect(self, train_x: torch.Tensor, train_y: torch.Te
167167

168168
import numpy as np
169169
from scipy.fftpack import fft
170-
from scipy.integrate import cumtrapz
170+
from scipy.integrate import cumulative_trapezoid
171171

172172
with torch.no_grad():
173173
if not torch.is_tensor(train_x) or not torch.is_tensor(train_y):
@@ -192,7 +192,7 @@ def initialize_from_data_empspect(self, train_x: torch.Tensor, train_y: torch.Te
192192
emp_spect = emp_spect[: M + 1]
193193

194194
total_area = np.trapz(emp_spect, freq)
195-
spec_cdf = np.hstack((np.zeros(1), cumtrapz(emp_spect, freq)))
195+
spec_cdf = np.hstack((np.zeros(1), cumulative_trapezoid(emp_spect, freq)))
196196
spec_cdf = spec_cdf / total_area
197197

198198
a = np.random.rand(1000, self.ard_num_dims)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def find_version(*file_paths):
4242
"jaxtyping>=0.2.9",
4343
"mpmath>=0.19,<=1.3", # avoid incompatibiltiy with torch+sympy with mpmath 1.4
4444
"scikit-learn",
45-
"scipy",
45+
"scipy>=1.6.0",
4646
"linear_operator>=0.5.2",
4747
]
4848
# if recent dev version of PyTorch is installed, no need to install stable

0 commit comments

Comments
 (0)