1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Tue, 24 Feb 2026 12:19:58 +0100
Subject: Add support for scikit-learn 1.8+
Author: James Gaboardi
Bug: https://github.com/pysal/esda/pull/400
Bug-Debian: https://bugs.debian.org/1127790
Origin: upstream, https://github.com/pysal/esda/commit/56bb603e75780874ae729404dab42a3b87eff2bc
---
esda/geary_local_mv.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/esda/geary_local_mv.py b/esda/geary_local_mv.py
index 6065a6b..fd61aab 100644
--- a/esda/geary_local_mv.py
+++ b/esda/geary_local_mv.py
@@ -1,10 +1,14 @@
import numpy as np
import pandas as pd
from libpysal import weights
+from packaging.version import Version
from scipy import stats
+from sklearn import __version__ as sklearn_version
from sklearn.base import BaseEstimator
from sklearn.utils import check_array
+SKL_GE_16 = Version(sklearn_version) >= Version("1.6")
+
class Geary_Local_MV(BaseEstimator): # noqa: N801
"""Local Geary - Multivariate"""
@@ -75,12 +79,15 @@ class Geary_Local_MV(BaseEstimator): # noqa: N801
>>> lG_mv.localG[0:5]
>>> lG_mv.p_sim[0:5]
"""
+
+ all_finite_kwarg = "ensure_all_finite" if SKL_GE_16 else "force_all_finite"
+
self.variables = check_array(
variables,
accept_sparse=False,
dtype="float",
- force_all_finite=True,
estimator=self,
+ **{all_finite_kwarg: True},
)
w = self.connectivity
|