Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9723115

Browse filesBrowse files
committed
Test and document pairwise_distances_argmin on sparse data
1 parent 3e357a2 commit 9723115
Copy full SHA for 9723115

File tree

Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed

‎sklearn/metrics/pairwise.py

Copy file name to clipboardExpand all lines: sklearn/metrics/pairwise.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,10 +721,10 @@ def pairwise_distances_argmin(X, Y, *, axis=1, metric="euclidean", metric_kwargs
721721
722722
Parameters
723723
----------
724-
X : array-like of shape (n_samples_X, n_features)
724+
X : {array-like, sparse matrix} of shape (n_samples_X, n_features)
725725
Array containing points.
726726
727-
Y : array-like of shape (n_samples_Y, n_features)
727+
Y : {array-like, sparse matrix} of shape (n_samples_Y, n_features)
728728
Arrays containing points.
729729
730730
axis : int, default=1

‎sklearn/metrics/tests/test_pairwise.py

Copy file name to clipboardExpand all lines: sklearn/metrics/tests/test_pairwise.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,9 @@ def test_pairwise_distances_argmin_min(dtype):
446446
assert_array_almost_equal(vals, expected_vals)
447447
# sparse matrix case
448448
idxsp, valssp = pairwise_distances_argmin_min(Xsp, Ysp, metric="euclidean")
449+
idxsp2 = pairwise_distances_argmin(Xsp, Ysp, metric="euclidean")
449450
assert_array_almost_equal(idxsp, expected_idx)
451+
assert_array_almost_equal(idxsp2, expected_idx)
450452
assert_array_almost_equal(valssp, expected_vals)
451453
# We don't want np.matrix here
452454
assert type(idxsp) == np.ndarray
@@ -478,7 +480,9 @@ def test_pairwise_distances_argmin_min(dtype):
478480
assert_array_almost_equal(vals, expected_vals)
479481
# sparse matrix case
480482
idxsp, valssp = pairwise_distances_argmin_min(Xsp, Ysp, metric="manhattan")
483+
idxsp2 = pairwise_distances_argmin(Xsp, Ysp, metric="manhattan")
481484
assert_array_almost_equal(idxsp, expected_idx)
485+
assert_array_almost_equal(idxsp2, expected_idx)
482486
assert_array_almost_equal(valssp, expected_vals)
483487

484488
# Non-euclidean Scipy distance (callable)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.