8000 DOC L1 distance works for sparse matrices · scikit-learn/scikit-learn@d62971d · GitHub
[go: up one dir, main page]

Skip to content

Commit d62971d

Browse files
committed
DOC L1 distance works for sparse matrices
This was implemented in 3bc3d9f.
1 parent 6430e19 commit d62971d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

sklearn/metrics/pairwise.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -994,20 +994,17 @@ def pairwise_distances(X, Y=None, metric="euclidean", n_jobs=1, **kwds):
994994
If Y is given (default is None), then the returned matrix is the pairwise
995995
distance between the arrays from both X and Y.
996996
997-
Please note that support for sparse matrices is currently limited to
998-
'euclidean', 'l2' and 'cosine'.
999-
1000997
Valid values for metric are:
1001998
1002-
- from scikit-learn: ['cityblock', 'cosine', 'euclidean', 'l1', 'l2',
1003-
'manhattan']
999+
- From scikit-learn: ['cityblock', 'cosine', 'euclidean', 'l1', 'l2',
1000+
'manhattan']. These metrics support sparse matrix inputs.
10041001
1005-
- from scipy.spatial.distance: ['braycurtis', 'canberra', 'chebyshev',
1002+
- From scipy.spatial.distance: ['braycurtis', 'canberra', 'chebyshev',
10061003
'correlation', 'dice', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis',
10071004
'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean',
10081005
'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule']
10091006
See the documentation for scipy.spatial.distance for details on these
1010-
metrics.
1007+
metrics. These metrics do not support sparse matrix inputs.
10111008
10121009
Note that in the case of 'cityblock', 'cosine' and 'euclidean' (which are
10131010
valid scipy.spatial.distance metrics), the scikit-learn implementation

0 commit comments

Comments
 (0)
0