pyriemann.embedding.SpectralEmbedding

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

Spectral Embedding of SPD/HPD matrices.

Spectral embedding uses Laplacian Eigenmaps [1] to embed SPD/HPD matrices into an Euclidean space of smaller dimension. The basic hypothesis is that high-dimensional data live 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/HPD 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, default=”riemann”

Metric used for defining pairwise distance between SPD/HPD matrices. For the list of supported metrics, see pyriemann.utils.distance.pairwise_distance().

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 matrices.

Attributes:
embedding_ndarray, shape (n_matrices, n_components)

Embedding vectors of the training set.

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 spectral embedding.

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

Set of SPD/HPD matrices.

yNone

Not used, here for compatibility with sklearn API.

Returns:
selfSpectralEmbedding instance

The SpectralEmbedding instance.

fit_transform(X, y=None)

Calculate the coordinates of the embedded matrices.

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

Set of SPD/HPD matrices.

yNone

Not used, here for compatibility with sklearn API.

Returns:
X_newndarray, shape (n_matrices, n_components)

Coordinates of embedded matrices.

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Returns:
routingMetadataRequest

A MetadataRequest encapsulating routing information.

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.

Examples using pyriemann.embedding.SpectralEmbedding

Sample from the Riemannian Gaussian distribution in the SPD manifold

Sample from the Riemannian Gaussian distribution in the SPD manifold

Data transformations in the Riemannian Procrustes Analysis

Data transformations in the Riemannian Procrustes Analysis