sklearn.metrics.pairwise.paired_euclidean_distances()

sklearn.metrics.pairwise.paired_euclidean_distances(X, Y) [source] Computes the paired euclidean distances between X and Y Read more in the User Guide. Parameters: X : array-like, shape (n_samples, n_features) Y : array-like, shape (n_samples, n_features) Returns: distances : ndarray (n_samples, )

sklearn.metrics.pairwise.paired_distances()

sklearn.metrics.pairwise.paired_distances(X, Y, metric='euclidean', **kwds) [source] Computes the paired distances between X and Y. Computes the distances between (X[0], Y[0]), (X[1], Y[1]), etc... Read more in the User Guide. Parameters: X : ndarray (n_samples, n_features) Array 1 for distance computation. Y : ndarray (n_samples, n_features) Array 2 for distance computation. metric : string or callable The metric to use when calculating distance between instances in a feature array.

sklearn.metrics.pairwise.paired_cosine_distances()

sklearn.metrics.pairwise.paired_cosine_distances(X, Y) [source] Computes the paired cosine distances between X and Y Read more in the User Guide. Parameters: X : array-like, shape (n_samples, n_features) Y : array-like, shape (n_samples, n_features) Returns: distances : ndarray, shape (n_samples, ) Notes The cosine distance is equivalent to the half the squared euclidean distance if each sample is normalized to unit norm

sklearn.metrics.pairwise.manhattan_distances()

sklearn.metrics.pairwise.manhattan_distances(X, Y=None, sum_over_features=True, size_threshold=500000000.0) [source] Compute the L1 distances between the vectors in X and Y. With sum_over_features equal to False it returns the componentwise distances. Read more in the User Guide. Parameters: X : array_like An array with shape (n_samples_X, n_features). Y : array_like, optional An array with shape (n_samples_Y, n_features). sum_over_features : bool, default=True If True the function re

sklearn.metrics.pairwise.linear_kernel()

sklearn.metrics.pairwise.linear_kernel(X, Y=None) [source] Compute the linear kernel between X and Y. Read more in the User Guide. Parameters: X : array of shape (n_samples_1, n_features) Y : array of shape (n_samples_2, n_features) Returns: Gram matrix : array of shape (n_samples_1, n_samples_2)

sklearn.metrics.pairwise.laplacian_kernel()

sklearn.metrics.pairwise.laplacian_kernel(X, Y=None, gamma=None) [source] Compute the laplacian kernel between X and Y. The laplacian kernel is defined as: K(x, y) = exp(-gamma ||x-y||_1) for each pair of rows x in X and y in Y. Read more in the User Guide. New in version 0.17. Parameters: X : array of shape (n_samples_X, n_features) Y : array of shape (n_samples_Y, n_features) gamma : float, default None If None, defaults to 1.0 / n_samples_X Returns: kernel_matrix : array of shape

sklearn.metrics.pairwise.kernel_metrics()

sklearn.metrics.pairwise.kernel_metrics() [source] Valid metrics for pairwise_kernels This function simply returns the valid pairwise distance metrics. It exists, however, to allow for a verbose description of the mapping for each of the valid strings. The valid distance metrics, and the function they map to, are: metric Function ?additive_chi2? sklearn.pairwise.additive_chi2_kernel ?chi2? sklearn.pairwise.chi2_kernel ?linear? sklearn.pairwise.linear_kernel ?poly? sklearn.pairwise.polynomi

sklearn.metrics.pairwise.euclidean_distances()

sklearn.metrics.pairwise.euclidean_distances(X, Y=None, Y_norm_squared=None, squared=False, X_norm_squared=None) [source] Considering the rows of X (and Y=X) as vectors, compute the distance matrix between each pair of vectors. For efficiency reasons, the euclidean distance between a pair of row vector x and y is computed as: dist(x, y) = sqrt(dot(x, x) - 2 * dot(x, y) + dot(y, y)) This formulation has two advantages over other ways of computing distances. First, it is computationally effi

sklearn.metrics.pairwise.distance_metrics()

sklearn.metrics.pairwise.distance_metrics() [source] Valid metrics for pairwise_distances. This function simply returns the valid pairwise distance metrics. It exists to allow for a description of the mapping for each of the valid strings. The valid distance metrics, and the function they map to, are: metric Function ?cityblock? metrics.pairwise.manhattan_distances ?cosine? metrics.pairwise.cosine_distances ?euclidean? metrics.pairwise.euclidean_distances ?l1? metrics.pairwise.manhattan_dis

sklearn.metrics.pairwise.cosine_similarity()

sklearn.metrics.pairwise.cosine_similarity(X, Y=None, dense_output=True) [source] Compute cosine similarity between samples in X and Y. Cosine similarity, or the cosine kernel, computes similarity as the normalized dot product of X and Y: K(X, Y) = <X, Y> / (||X||*||Y||) On L2-normalized data, this function is equivalent to linear_kernel. Read more in the User Guide. Parameters: X : ndarray or sparse array, shape: (n_samples_X, n_features) Input data. Y : ndarray or sparse array,