pyriemann.utils.distance.distance

pyriemann.utils.distance.distance(A, B, metric='riemann', squared=False)

Distance between matrices according to a metric.

Compute the distance between two matrices A and B according to a metric [1], or between a set of matrices A and another matrix B.

Parameters:
Andarray, shape (n, n) or shape (n_matrices, n, n)

First matrix, or set of matrices.

Bndarray, shape (n, n)

Second matrix.

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:
dfloat or ndarray, shape (n_matrices, 1)

Distance between A and B.

References

[1]

Review of Riemannian distances and divergences, applied to SSVEP-based BCI S. Chevallier, E. K. Kalunga, Q. Barthélemy, E. Monacelli. Neuroinformatics, Springer, 2021, 19 (1), pp.93-106