pyriemann.embedding.locally_linear_embedding¶
- pyriemann.embedding.locally_linear_embedding(X, *, n_components=2, n_neighbors=5, metric='riemann', reg=0.001)¶
Perform a Locally Linear Embedding (LLE) of SPD matrices.
As proposed in [1], Locally Linear Embedding (LLE) is a non-linear, neighborhood-preserving dimensionality reduction algorithm which consists of three main steps. For each point xi,
find its k nearest neighbors KNN(xi),
calculate the best reconstruction of xi based on its k-nearest neighbors (Eq.9 in [1]),
calculate a low-dimensional embedding for all points based on the weights in step 2.
- Parameters:
- Xndarray, shape (n_matrices, n_channels, n_channels)
Set of SPD matrices.
- n_componentsint, default=2
Dimensionality of projected space.
- n_neighborsint, default=5
Number of neighbors for reconstruction of each point.
- metric{‘riemann’, ‘logeuclid’, ‘euclid’}, default: ‘riemann’
Metric used for KNN and Kernel estimation.
- regfloat, default=1e-3
Regularization parameter.
- Returns:
- embdndarray, shape (n_matrices, n_components)
Locally linear embedding of matrices in X.
- errorfloat
Error of the projected embedding.
Notes
New in version 0.3.
References
[1] (1,2)Clustering and dimensionality reduction on Riemannian manifolds A. Goh and R. Vidal, in 2008 IEEE Conference on Computer Vision and Pattern Recognition