spd_learn.functional.kernel#
- spd_learn.functional.kernel(X, Y=None, *, Cref=None, metric='riemann', reg=1e-10)[source]#
Kernel matrix between matrices according to a specified metric.
It calculates the kernel matrix \(\mathbf{K}\) of pairwise inner products of two sets \(\mathbf{X}\) and \(\mathbf{Y}\) of matrices on the tangent space at \(\mathbf{C}_\text{ref}\), according to a specified metric.
- Parameters:
X (ndarray, shape (n_matrices_X, n, n)) – First set of matrices.
Y (None | ndarray, shape (n_matrices_Y, n, n), default=None) – Second set of matrices. If None, Y is set to X.
Cref (None | ndarray, shape (n, n), default=None) – Reference matrix.
metric (string | callable, default="riemann") – Metric used for tangent space and mean estimation, can be: “euclid”, “logeuclid”, “riemann”, or a callable function.
reg (float, 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:
K – Kernel matrix between X and Y.
- Return type:
ndarray, shape (n_matrices_X, n_matrices_Y)
Notes
Added in version 0.3.
Changed in version 0.12: Add support for NumPy and PyTorch.
See also