8000 Merge pull request #4516 from amueller/distance_function_docstring · scikit-learn/scikit-learn@9206a78 · GitHub
[go: up one dir, main page]

Skip to cont 8000 ent

Commit 9206a78

Browse files
committed
Merge pull request #4516 from amueller/distance_function_docstring
[MRG] DOC try to clarify pairwise_distances docstring for Y.
2 parents 871ffec + 485974f commit 9206a78

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sklearn/metrics/pairwise.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,7 @@ def paired_cosine_distances(X, Y):
602602
'l2': paired_euclidean_distances,
603603
'l1': paired_manhattan_distances,
604604
'manhattan': paired_manhattan_distances,
605-
'cityblock': paired_manhattan_distances,
606-
}
605+
'cityblock': paired_manhattan_distances}
607606

608607

609608
def paired_distances(X, Y, metric="euclidean", **kwds):
@@ -1050,8 +1049,8 @@ def pairwise_distances(X, Y=None, metric="euclidean", n_jobs=1, **kwds):
10501049
[n_samples_a, n_features] otherwise
10511050
Array of pairwise distances between samples, or a feature array.
10521051
1053-
Y : array [n_samples_b, n_features]
1054-
A second feature array only if X has shape [n_samples_a, n_features].
1052+
Y : array [n_samples_b, n_features], optional
1053+
An optional second feature array. Only allowed if metric != "precomputed".
10551054
10561055
metric : string, or callable
10571056
The metric to use when calculating distance between instances in a
@@ -1089,7 +1088,7 @@ def pairwise_distances(X, Y=None, metric="euclidean", n_jobs=1, **kwds):
10891088
10901089
"""
10911090
if (metric not in _VALID_METRICS and
1092-
not callable(metric) and metric != "precomputed"):
1091+
not callable(metric) and metric != "precomputed"):
10931092
raise ValueError("Unknown metric %s. "
10941093
"Valid metrics are %s, or 'precomputed', or a "
10951094
"callable" % (metric, _VALID_METRICS))

0 commit comments

Comments
 (0)
0