From 22e4618d7f0bcd9714fb0066d272d077a4b9e7d4 Mon Sep 17 00:00:00 2001 From: VNMabus Date: Sat, 17 Aug 2024 12:46:14 +0200 Subject: [PATCH] Support SciPy 1.14. Fixed the code that was failing in the tests for Scipy 1.14: - Calls to simpson with more than one positional parameters are invalid (https://github.com/scipy/scipy/pull/20554). - Representation of SciPy sparse matrix in doctests has changed (https://github.com/scipy/scipy/pull/20649). - As this change makes tests fail for previous SciPy versions, the minimum version of SciPy used for tests has been set to 1.14. --- pyproject.toml | 3 ++- skfda/_utils/_neighbors_base.py | 9 ++++++--- skfda/representation/irregular.py | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 780a39ef7..83c27fae0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dependencies = [ "rdata", "scikit-datasets[cran]>=0.2.2", "scikit-learn>=0.20", - "scipy>=1.6.0, <1.14", + "scipy>=1.6.0", "typing-extensions", ] @@ -64,6 +64,7 @@ test = [ "pytest", "pytest-env", "pytest-subtests", + "scipy>=1.14", # Changes in sparse array representation. ] [project.urls] diff --git a/skfda/_utils/_neighbors_base.py b/skfda/_utils/_neighbors_base.py index 7188d19e4..c6b97bba2 100644 --- a/skfda/_utils/_neighbors_base.py +++ b/skfda/_utils/_neighbors_base.py @@ -313,9 +313,12 @@ def kneighbors_graph( >>> graph = neigh.kneighbors_graph(X[0]) >>> print(graph) - (0, 0) 1.0 - (0, 8) 1.0 - (0, 1) 1.0 + + Coords Values + (0, 0) 1.0 + (0, 8) 1.0 + (0, 1) 1.0 Notes: This method wraps the corresponding sklearn routine in the diff --git a/skfda/representation/irregular.py b/skfda/representation/irregular.py index e03513a06..07cce5e77 100644 --- a/skfda/representation/irregular.py +++ b/skfda/representation/irregular.py @@ -627,7 +627,7 @@ def integrate( values_list = np.split(data.values, data.start_indices[1:]) points_list = np.split(data.points, data.start_indices[1:]) return np.array([ - scipy.integrate.simpson(y, x, axis=0) + scipy.integrate.simpson(y, x=x, axis=0) for y, x in zip(values_list, points_list) ])