pyriemann.embedding.barycenter_weights

pyriemann.embedding.barycenter_weights(X, Y, indices, metric='riemann', kernel=None, reg=0.001)

Compute barycenter weights of X from Y along the first axis.

Estimates the weights to assign to each matrix in Y[indices] to recover the matrix X[i] by geodesic interpolation. The barycenter weights sum to 1.

Parameters:
Xndarray, shape (n_matrices, n_channels, n_channels)

Set of SPD matrices.

Yndarray, shape (n_matrices, n_channels, n_channels)

Set of SPD matrices.

indicesndarray, shape (n_matrices, n_neighbors)

Indices of matrices in Y used to compute the barycenter.

metricstring, default=”riemann”

Kernel metric. For the list of supported metrics, see pyriemann.utils.kernel.kernel().

kernelcallable | None, default=None

Kernel function to use for the embedding. If None, the canonical kernel specified by the metric is used. Must be a function that takes the arguments (X, Cref, metric).

regfloat, default=1e-3

Amount of regularization to add for the problem to be well-posed in the case of n_neighbors > n_channels.

Returns:
Bndarray, shape (n_matrices, n_neighbors)

Interpolation weights.

Notes

Added in version 0.3.