pyriemann.embedding.SpectralEmbedding

class pyriemann.embedding.SpectralEmbedding(n_components=2, metric='riemann', eps=None)

Spectral embedding of SPD matrices into an Euclidean space.

It uses Laplacian Eigenmaps [1] to embed SPD matrices into an Euclidean space of smaller dimension. The basic hypothesis is that high-dimensional data lives in a low-dimensional manifold, whose intrinsic geometry can be described via the Laplacian matrix of a graph. The vertices of this graph are the SPD matrices and the weights of the links are determined by the Riemannian distance between each pair of them.

Parameters
n_componentsinteger, default=2

The dimension of the projected subspace.

metricstring | dict, default=’riemann’

The type of metric to be used for defining pairwise distance between SPD matrices.

epsNone | float, default=None

The scaling of the Gaussian kernel. If none is given it will use the square of the median of pairwise distances between points.

References

1

Laplacian Eigenmaps for dimensionality reduction and data representation M. Belkin and P. Niyogi, in Neural Computation, vol. 15, no. 6, p. 1373-1396 , 2003

__init__(n_components=2, metric='riemann', eps=None)

Init.

fit(X, y=None)

Fit the model from data in X.

Parameters
Xndarray, shape (n_matrices, n_channels, n_channels)

Set of SPD matrices.

yNone

Not used, here for compatibility with sklearn API.

Returns
selfobject

Returns the instance itself.

fit_transform(X, y=None)

Calculate the coordinates of the embedded points.

Parameters
Xndarray, shape (n_matrices, n_channels, n_channels)

Set of SPD matrices.

yNone

Not used, here for compatibility with sklearn API.

Returns
X_newndarray, shape (n_matrices, n_components)

Coordinates of embedded matrices.

get_params(deep=True)

Get parameters for this estimator.

Parameters
deepbool, default=True

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns
paramsdict

Parameter names mapped to their values.

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters
**paramsdict

Estimator parameters.

Returns
selfestimator instance

Estimator instance.