diff --git a/gpytorch/kernels/spectral_delta_kernel.py b/gpytorch/kernels/spectral_delta_kernel.py index 4262c0178..176e788ae 100644 --- a/gpytorch/kernels/spectral_delta_kernel.py +++ b/gpytorch/kernels/spectral_delta_kernel.py @@ -52,7 +52,7 @@ def initialize_from_data(self, train_x, train_y): """ import numpy as np from scipy.fftpack import fft - from scipy.integrate import cumtrapz + from scipy.integrate import cumulative_trapezoid N = train_x.size(-2) 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): emp_spect = emp_spect[: M + 1] total_area = np.trapz(emp_spect, freq) - spec_cdf = np.hstack((np.zeros(1), cumtrapz(emp_spect, freq))) + spec_cdf = np.hstack((np.zeros(1), cumulative_trapezoid(emp_spect, freq))) spec_cdf = spec_cdf / total_area a = np.random.rand(self.raw_Z.size(-2), 1) diff --git a/gpytorch/kernels/spectral_mixture_kernel.py b/gpytorch/kernels/spectral_mixture_kernel.py index e63185ff4..c8de79010 100644 --- a/gpytorch/kernels/spectral_mixture_kernel.py +++ b/gpytorch/kernels/spectral_mixture_kernel.py @@ -167,7 +167,7 @@ def initialize_from_data_empspect(self, train_x: torch.Tensor, train_y: torch.Te import numpy as np from scipy.fftpack import fft - from scipy.integrate import cumtrapz + from scipy.integrate import cumulative_trapezoid with torch.no_grad(): 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 emp_spect = emp_spect[: M + 1] total_area = np.trapz(emp_spect, freq) - spec_cdf = np.hstack((np.zeros(1), cumtrapz(emp_spect, freq))) + spec_cdf = np.hstack((np.zeros(1), cumulative_trapezoid(emp_spect, freq))) spec_cdf = spec_cdf / total_area a = np.random.rand(1000, self.ard_num_dims) diff --git a/setup.py b/setup.py index 0243778c2..1a86a2632 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ def find_version(*file_paths): "jaxtyping>=0.2.9", "mpmath>=0.19,<=1.3", # avoid incompatibiltiy with torch+sympy with mpmath 1.4 "scikit-learn", - "scipy", + "scipy>=1.6.0", "linear_operator>=0.5.2", ] # if recent dev version of PyTorch is installed, no need to install stable