1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
From c7d05683325589ad432a55e109cacb9d631cfaa9 Mon Sep 17 00:00:00 2001
From: Leland McInnes <leland.mcinnes@gmail.com>
Date: Mon, 26 Dec 2022 17:44:46 -0500
Subject: [PATCH] Sklearn pairwise_distances doesn't support np.matrix anymore
---
umap/tests/test_umap_metrics.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/umap/tests/test_umap_metrics.py
+++ b/umap/tests/test_umap_metrics.py
@@ -122,7 +122,7 @@
assert (
metric in spdist.sparse_named_distances
), f"{metric} not supported for sparse data"
- dist_matrix = pairwise_distances(sparse_spatial_data.todense(), metric=metric)
+ dist_matrix = pairwise_distances(np.asarray(sparse_spatial_data.todense()), metric=metric)
if metric in ("braycurtis", "dice", "sokalsneath", "yule"):
dist_matrix[np.where(~np.isfinite(dist_matrix))] = 0.0
|