pyriemann.utils.distance.distance_wasserstein¶
- pyriemann.utils.distance.distance_wasserstein(A, B)¶
Wasserstein distance between SPSD/HPSD matrices.
The Wasserstein distance between two SPSD/HPSD matrices A and B is [1] [2]:
\[d(\mathbf{A},\mathbf{B}) = \sqrt{ \text{tr}(A + B - 2(B^{1/2} A B^{1/2})^{1/2}) }\]- Parameters
- Andarray, shape (…, n, n)
First SPSD/HPSD matrices, at least 2D ndarray.
- Bndarray, shape (…, n, n)
Second SPSD/HPSD matrices, same dimensions as A.
- Returns
- dndarray, shape (…,) or float
Wasserstein distance between A and B.
References
- 1
Optimal transport: old and new C. Villani. Springer Science & Business Media, 2008, vol. 338
- 2
An extension of Kakutani’s theorem on infinite product measures to the tensor product of semifinite w*-algebras D. Bures. Trans Am Math Soc, 1969, 135, pp. 199-212