diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f4466..a538420 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning][]. ### Fixed - Fix neighbors connectivities in test to use new scanpy fn {pr}`170`. +- Fix Kmeans test {pr}`172`. ## 0.5.1 (2024-02-23) diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 81a2a6c..c55e079 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -133,9 +133,10 @@ def test_isolated_labels(): def test_kmeans(): - centers = [[1, 1], [-1, -1], [1, -1]] + centers = np.array([[1, 1], [-1, -1], [1, -1]]) * 2 len(centers) - X, labels_true = make_blobs(n_samples=3000, centers=centers, cluster_std=0.7) + X, labels_true = make_blobs(n_samples=3000, centers=centers, cluster_std=0.7, random_state=42) + kmeans = scib_metrics.utils.KMeans(n_clusters=3) kmeans.fit(X) assert kmeans.labels_.shape == (X.shape[0],) diff --git a/tests/test_neighbors.py b/tests/test_neighbors.py index de93c42..1a35748 100644 --- a/tests/test_neighbors.py +++ b/tests/test_neighbors.py @@ -18,7 +18,6 @@ def test_neighbors_results(n): neigh_result = pynndescent(adata.obsm[embedding_keys[0]], n_neighbors=n) neigh_result = neigh_result.subset_neighbors(n=n) new_connect = neigh_result.knn_graph_connectivities - new_dist = neigh_result.knn_graph_distances sc_connect = sc.neighbors._connectivity.umap( neigh_result.indices[:, :n], neigh_result.distances[:, :n], n_obs=adata.n_obs, n_neighbors=n