pyriemann.utils.kernel.kernel

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

Kernel matrix between SPD matrices according to a specified metric.

Calculates the kernel matrix K of inner products of two sets X and Y of SPD matrices on the tangent space of Cref according to a specified metric.

Parameters
Xndarray, shape (n_matrices_X, n_channels, n_channels)

First set of SPD matrices.

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

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

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

Reference point for the tangent space and inner product calculation. Only used if metric=’riemann’.

metric{‘euclid’, ‘logeuclid’, ‘riemann’}, default=’riemann’

The type of metric used for tangent space and mean estimation.

regfloat, default=1e-10

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)

The kernel matrix between X and Y.

Notes

New in version 0.3.