pyriemann.utils.distance.pairwise_distance

pyriemann.utils.distance.pairwise_distance(X, Y=None, metric='riemann', squared=False)

Pairwise distance matrix.

Compute the matrix of distances between pairs of elements of X and Y.

Parameters
Xndarray, shape (n_matrices_X, n, n)

First set of matrices.

YNone | ndarray, shape (n_matrices_Y, n, n), default=None

Second set of matrices. If None, Y is set to X.

metricstring, default=’riemann’

The metric for distance, can be: ‘euclid’, ‘harmonic’, ‘kullback’, ‘kullback_right’, ‘kullback_sym’, ‘logdet’, ‘logeuclid’, ‘riemann’, ‘wasserstein’, or a callable function.

squaredbool, default False

Return squared distance.

New in version 0.5.

Returns
distndarray, shape (n_matrices_X, n_matrices_X) or (n_matrices_X, n_matrices_Y)

Distances between pairs of elements of X if Y is None, or between elements of X and Y.

See also

distance