diff --git a/skgstat/MetricSpace.py b/skgstat/MetricSpace.py index 3a3361e..c535313 100644 --- a/skgstat/MetricSpace.py +++ b/skgstat/MetricSpace.py @@ -777,14 +777,16 @@ def dists(self): # from https://stackoverflow.com/questions/28677162/ignoring-duplicate-entries-in-sparse-matrix # Stable solution but a bit slow - # c, eq, d = zip(*set(zip(c, eq, d))) - # dists = sparse.csr_matrix((d, (c, eq)), shape=(len(self.coords), len(self.coords))) + c, eq, d = zip(*set(zip(c, eq, d))) + dists = sparse.csr_matrix((d, (c, eq)), shape=(len(self.coords), len(self.coords))) + # comment mmaelicke: We need to fall back to the slower solution as dok._update is not supported in scipy 1.0 anymore + # # Solution 5+ times faster than the preceding, but relies on _update() which might change in scipy (which # only has an implemented method for summing duplicates, and not ignoring them yet) - dok = sparse.dok_matrix((len(self.coords), len(self.coords))) - dok._update(zip(zip(c, eq), d)) - dists = dok.tocsr() + # dok = sparse.dok_matrix((len(self.coords), len(self.coords))) + # dok._update(zip(zip(c, eq), d)) + # dists = dok.tocsr() self._dists = dists diff --git a/skgstat/tests/test_variogram.py b/skgstat/tests/test_variogram.py index f1a6273..68020f6 100644 --- a/skgstat/tests/test_variogram.py +++ b/skgstat/tests/test_variogram.py @@ -896,7 +896,7 @@ def test_harmonize_model(self): assert_array_almost_equal( V.transform(x), - [np.NaN, 0.57, 1.01, 1.12, 1.15, 1.15, 1.15, 1.15, 1.21, 1.65], + [np.nan, 0.57, 1.01, 1.12, 1.15, 1.15, 1.15, 1.15, 1.21, 1.65], decimal=2 )