paired_euclidean_distances#

sklearn.metrics.pairwise.paired_euclidean_distances(X, Y)[source]#

Compute the paired euclidean distances between X and Y.

Distances are calculated between (X[0], Y[0]), (X[1], Y[1]), …, etc.

Read more in the User Guide.

Parameters:
X{array-like, sparse matrix} of shape (n_samples, n_features)

Input array/matrix X.

Y{array-like, sparse matrix} of shape (n_samples, n_features)

Input array/matrix Y.

Returns:
distancesndarray of shape (n_samples,)

Returns the euclidean distances between the row vectors of X and the row vectors of Y, where distances[i] is the distance between X[i] and Y[i].

Examples

>>> from sklearn.metrics.pairwise import paired_euclidean_distances
>>> X = [[0, 0, 0], [1, 1, 1]]
>>> Y = [[1, 0, 0], [1, 1, 0]]
>>> paired_euclidean_distances(X, Y)
array([1., 1.])