#NEWLINE# def pairwise_distances_argmin( X , Y , axis = 1 , metric = 'euclidean' , batch_size = 500 , metric_kwargs = None ) : #NEWLINE# #INDENT# "Compute minimum distances between one point and a set of points.\n\n    This function computes for each row in X, the index of the row of Y which\n    is closest (according to the specified distance).\n\n    This is mostly equivalent to calling:\n\n        pairwise_distances(X, Y=Y, metric=metric).argmin(axis=axis)\n\n    but uses much less memory, and is faster for large arrays.\n\n    This function works with dense 2D arrays only.\n\n    Parameters\n    ----------\n    X : array-like\n        Arrays containing points. Respective shapes (n_samples1, n_features)\n        and (n_samples2, n_features)\n\n    Y : array-like\n        Arrays containing points. Respective shapes (n_samples1, n_features)\n        and (n_samples2, n_features)\n\n    batch_size : integer\n        To reduce memory consumption over the naive solution, data are\n        processed in batches, comprising batch_size rows of X and\n        batch_size rows of Y. The default value is quite conservative, but\n        can be changed for fine-tuning. The larger the number, the larger the\n        memory usage.\n\n    metric : string or callable\n        metric to use for distance computation. Any metric from scikit-learn\n        or scipy.spatial.distance can be used.\n\n        If metric is a callable function, it is called on each\n        pair of instances (rows) and the resulting value recorded. The callable\n        should take two arrays as input and return one value indicating the\n        distance between them. This works for Scipy's metrics, but is less\n        efficient than passing the metric name as a string.\n\n        Distance matrices are not supported.\n\n        Valid values for metric are:\n\n        - from scikit-learn: ['cityblock', 'cosine', 'euclidean', 'l1', 'l2',\n          'manhattan']\n\n        - from scipy.spatial.distance: ['braycurtis', 'canberra', 'chebyshev',\n          'correlation', 'dice', 'hamming', 'jaccard', 'kulsinski',\n          'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto',\n          'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath',\n          'sqeuclidean', 'yule']\n\n        See the documentation for scipy.spatial.distance for details on these\n        metrics.\n\n    metric_kwargs : dict\n        keyword arguments to pass to specified metric function.\n\n    axis : int, optional, default 1\n        Axis along which the argmin and distances are to be computed.\n\n    Returns\n    -------\n    argmin : numpy.ndarray\n        Y[argmin[i], :] is the row in Y that is closest to X[i, :].\n\n    See also\n    --------\n    sklearn.metrics.pairwise_distances\n    sklearn.metrics.pairwise_distances_argmin_min\n    " #NEWLINE# if ( metric_kwargs is None ) : #NEWLINE# #INDENT# metric_kwargs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# return pairwise_distances_argmin_min ( X , Y , axis , metric , batch_size , metric_kwargs ) [ 0 ]