Compute the paired L1 distances between X and Y.
Distances are calculated between (X[0], Y[0]), (X[1], Y[1]), …, (X[n_samples], Y[n_samples]).
Read more in the User Guide.
An array-like where each row is a sample and each column is a feature.
An array-like where each row is a sample and each column is a feature.
L1 paired distances between the row vectors of X and the row vectors of Y.
>>> from sklearn.metrics.pairwise import paired_manhattan_distances >>> import numpy as np >>> X = np.array([[1, 1, 0], [0, 1, 0], [0, 0, 1]]) >>> Y = np.array([[0, 1, 0], [0, 0, 1], [0, 0, 0]]) >>> paired_manhattan_distances(X, Y) array([1., 2., 1.])
© 2007–2025 The scikit-learn developers
Licensed under the 3-clause BSD License.
https://scikit-learn.org/1.6/modules/generated/sklearn.metrics.pairwise.paired_manhattan_distances.html