pyriemann.embedding.TSNE

class pyriemann.embedding.TSNE(n_components=2, perplexity=None, metric='riemann', max_iter=200, random_state=None)

T-distributed Stochastic Neighbor Embedding (t-SNE) of SPD/HPD matrices.

T-distributed Stochastic Neighbor Embedding (t-SNE) reduces a set of high-dimensional SPD/HPD matrices into a set of low-dimensional SPD/HPD matrices [1].

Parameters:
n_componentsint, default=2

Low dimension of the matrices in the embedded space.

perplexityint, default=None

Perplexity used in the t-SNE algorithm. If None, it will be set to 0.75*n_matrices.

metric{“euclid”, “logeuclid”, “riemann”}, default=”riemann”

Metric for the gradient descent.

max_iterint, default=200

Maximum number of iterations used for the gradient descent.

random_stateint, default=None

Pass an int for reproducible output across multiple function calls.

Attributes:
embedding_ndarray, shape (n_matrices, n_components, n_components)

Embedding matrices of the training set.

Notes

Added in version 0.9.

References

[1]

Geometry-Aware visualization of high dimensional Symmetric Positive Definite matrices T. de Surrel, S. Chevallier, F. Lotte and F. Yger. Transactions on Machine Learning Research, 2025

__init__(n_components=2, perplexity=None, metric='riemann', max_iter=200, random_state=None)
fit(X, y=None)

Fit TSNE.

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

Set of high-dimensional SPD/HPD matrices.

yNone

Not used, here for compatibility with sklearn API.

Returns:
selfTSNE instance

The TSNE instance.

fit_transform(X, y=None)

Calculate the embedded matrices.

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

Set of high-dimensional SPD/HPD matrices.

yNone

Not used, here for compatibility with sklearn API.

Returns:
X_newndarray, shape (n_matrices, n_components, n_components)

Set of low-dimensional 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.