Skip to content

Commit f2c200e

Browse files
committed
Merge pull request scikit-learn#3962 from MechCoder/check_X_y
[MRG] ENH: Use check_X_y in pairwise_distances_argmin
2 parents b8b68e3 + e6a464b commit f2c200e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sklearn/metrics/pairwise.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ def pairwise_distances_argmin_min(X, Y, axis=1, metric="euclidean",
344344

345345

346346
def pairwise_distances_argmin(X, Y, axis=1, metric="euclidean",
347-
batch_size=500, metric_kwargs={}):
347+
batch_size=500, metric_kwargs={},
348+
check_X_y=True):
348349
"""Compute minimum distances between one point and a set of points.
349350
350351
This function computes for each row in X, the index of the row of Y which
@@ -399,6 +400,10 @@ def pairwise_distances_argmin(X, Y, axis=1, metric="euclidean",
399400
metric_kwargs : dict
400401
keyword arguments to pass to specified metric function.
401402
403+
check_X_y : bool, default True
404+
Whether or not to check X and y for shape, validity and dtype. Speed
405+
improvements possible if set to False when called repeatedly.
406+
402407
Returns
403408
=======
404409
argmin : numpy.ndarray
@@ -410,7 +415,7 @@ def pairwise_distances_argmin(X, Y, axis=1, metric="euclidean",
410415
sklearn.metrics.pairwise_distances_argmin_min
411416
"""
412417
return pairwise_distances_argmin_min(X, Y, axis, metric, batch_size,
413-
metric_kwargs)[0]
418+
metric_kwargs, check_X_y)[0]
414419

415420

416421
def manhattan_distances(X, Y=None, sum_over_features=True,

0 commit comments

Comments
 (0)