pyriemann.utils.kernel.kernel_logeuclid

pyriemann.utils.kernel.kernel_logeuclid(X, Y=None, *, Cref=None, reg=1e-10)

Log-Euclidean kernel between two sets of SPD matrices.

Log-Euclidean kernel matrix \(\mathbf{K}\) of two sets \(\mathbf{X}\) and \(\mathbf{Y}\) of SPD matrices in \(\mathbb{R}^{n \times n}\) on tangent space at \(\mathbf{C}_\text{ref}\) is calculated with pairwise inner products [1]:

\[\mathbf{K}_{i,j} = \text{tr}( (\log(\mathbf{X}_i) - \log(\mathbf{C}_\text{ref})) (\log(\mathbf{Y}_j) - \log(\mathbf{C}_\text{ref})) )\]

If \(\mathbf{C}_\text{ref}\) is None [2]:

\[\mathbf{K}_{i,j} = \text{tr}(\log(\mathbf{X}_i) \log(\mathbf{Y}_j))\]
Parameters:
Xndarray, shape (n_matrices_X, n, n)

First set of SPD matrices.

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

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

CrefNone | ndarray, shape (n, n), default=None

Reference SPD matrix. If None, Cref is defined as identity matrix.

Added in version 0.8.

regfloat, default=1e-10

When Y is None, regularization parameter to mitigate numerical errors in kernel matrix estimation, to provide a positive-definite kernel matrix.

Returns:
Kndarray, shape (n_matrices_X, n_matrices_Y)

Log-Euclidean kernel matrix between X and Y.

See also

kernel

Notes

Added in version 0.3.

Changed in version 0.8: Add parameter Cref to use a reference matrix.

References

[1]

A New Canonical Log-Euclidean Kernel for Symmetric Positive Definite Matrices for EEG Analysis G. L. W. vom Berg, V. Rohr, D. Platt and B. Blankertz. IEEE Transactions on Biomedical Engineering, 2024

[2]

Factor analysis based spatial correlation modeling for speaker verification E. Wang, W. Guo, L. Dai, K. Lee, B. Ma and H. Li. IEEE ISCSLP, 2010