Adapted from an appendix of my MS thesis.
Tangent Space
Current state-of-the-art (SOTA) machine learning (ML) for electroencephalogram (EEG) uses across channel covariance matrices and Riemannian geometric statistics on the symmetric positive definite (SPD) manifold for classification [1, 2]. These methods either discriminate directly on the SPD manifold or in the vector space that is tangent to the manifold. In this section we analyze the latter method of discrimination that performs classification in the tangent space (TS) of the SPD manifold.
Definitions
A manifold is a collection of points that locally, but not globally, resembles Euclidean space. A Riemannian metric is defined by a smoothly varying collection of scalar products in each tangent space at points on a manifold . For example, the inner product gives a norm by . The shortest distance between two points on a manifold is a geodesic , and it is computed by integrating the norm along its curve [3].
We can map vectors in the tangent space to the manifold using geodesics. The vector can be mapped to the point of the manifold that is reached after a unit time by the geodesic starting at with initial velocity . This mapping is called the exponential map where . The inverse of the exponential map is the logarithmic map and is the smallest vector as measured by the Riemannian metric so that [3].
In general, finding geodesics involves solving second-order ordinary differential equations (ODEs) [3]. However, SPD matrices have additional Lie group structure that can be used to simplify algorithms and speed up computations of Riemannian metrics and geodesics [4]. A group is a set with an associative binary operation satisfying for all , contains an identity element so that for all , and contains an inverse element for each where . A Lie group is a smooth manifold and also a group [3].
For each in a Lie group , left-translations by are denoted . The differential of left-translation maps the tangent space to the tangent space . In particular, maps any vector to the vector . The vector field is called left-invariant since it is invariant under left-translations for all [3]. In other words, pullback to the identity and pushforward to another object are commutative under left-translation.
The left-translation maps give a useful way of defining Riemannian metrics on Lie groups. By definition the tangent space of a Lie group at the identity element, typically denoted , is called a Lie algebra. Given an inner product on the Lie algebra, we can extend it to an inner product on tangent spaces at all elements of the group by setting . This defines a left-invariant Riemannian metric on since for any [3].
For a matrix and any non-zero vector , if and , then is an SPD matrix [5]. The space of SPD matrices is a smooth manifold, and not a vector space since it lacks an additive identity, additive inverses, and zero and negative real scalar multiplication [4]. The SPD manifold of all SPD matrices is a Lie group with matrix multiplication as its group operation [3]. Therefore, we can derive invariant metrics and geodesics on the SPD manifold.
Let be a matrix from the general linear group of non-singular matrices. Then since and for any non-zero vector then . Given two matrices we can derive the distance between them as a norm from the identity by choosing [4]. That is, with left-invariance we can pullback to the identity before pushforward.
By left-invariance at the identity of a Lie group we have the vector field . The geodesic starting at the identity with initial velocity satisfies and . For matrix groups, this ODE becomes and is uniquely solved by the matrix exponential . In other words, the exponential map is the matrix exponential and its inverse the logarithmic map is the matrix logarithm [3].
From the figure take . The matrix logarithm produces the vector for the norm . This norm is given by the Frobenius norm . Furthermore, since is SPD, it has eigendecomposition where and . By the matrix logarithm . Therefore, by the orthogonal invariance of the Frobenius norm, the norm can be written as the square root of the sum of squared eigenvalue logarithms [4].
the figure gives a closed form solution for the distance between two SPD matrices on . Not only is it exact and so does not require optimization, but it can be computed in the vector space of the tangent space and so does not require integration on the curve. Furthermore, by the nature of logarithms we see that matrices with zero or negative eigenvalue are in fact infinite distance from SPD matrices on , contrary to Euclidean space and metrics [4].
We can also find closed form solutions for the logarithmic and exponential maps on . Rather than solve for the norm of the logarithmic map, we can solve for the vector itself. This is done by pushing forward to after we pulled back to the identity from . Furthermore, as the inverse of the logarithmic map, the closed form solution for the exponential map takes a vector as input and outputs the point on reached after unit time elapsed along the geodesic.
At the foundation of statistics is the notion of a distance. The closed form solution of the mean in Euclidean space relies on the additive structure of vector space and does not generalize to Riemannian space. However, there are defining properties of the mean that do generalize: The geometric mean is a least-squares centroid that minimizes the sum-of-squared distances. A natural strategy for computing the geometric mean is gradient descent optimization [6].
The exponential and logarithmic map, distance, and mean on are common Riemannian geometric statistics used by SOTA ML for EEG that takes across channel sample covariance matrices for classification [1, 2]. The minimum distance to the mean (MDM) classifier is trained by memorizing the mean of each class and is tested by predicting classes based on the minimum distance to the memorized means [1]. All operations occur on the SPD manifold. In the next section we describe in more detail an alternative algorithm that performs classification in the tangent space of .
Example
Consider two three-dimensional tensors of EEG recordings from separate classes where the dimensions are the trials, channels, and time, respectively. For each trial, let sample covariance matrices (SCMs) be computed between channels across time so that for . Assume each SCM is conditioned so that it is SPD. Furthermore, let us define as geometric mean SCMs averaged across all trials of each class.
With the geometric mean of each class we define as the geometric mean of these means. Then, using the logarithmic map we find the vectors between all points in all clusters to . We represent these vectors in the tangent space of the mean point . This linearization of SPD matrices is done in a way that respects the metric space of . Once in the tangent space we can train standard ML algorithms that are optimized for vector space.
Once in the tangent space we can train standard ML algorithms that are optimized for vector space. This method of linearization from the space of SPD matrices to vector space is the standard used by software libraries like PyRiemann [7]. As of now, SOTA EEG classifiers are those that learn and predict in the tangent space of the SPD manifold rather than on the manifold itself [1, 2]. An explanation for this is that machine learning is traditionally optimized for vector space.
References
- Barachant, Alexandre, Bonnet, Stéphane, Congedo, Marco, Jutten, Christian (2012) Multiclass Brain–Computer Interface Classification by Riemannian Geometry. IEEE Transactions on Biomedical Engineering.
- Sylvain Chevallier, Emmanuel K. Kalunga, Quentin Barthélemy, Florian Yger (2018) Riemannian Classification for SSVEP-Based BCI: Offline versus Online Implementations. CRC Press.
- Stefan Sommer, Tom Fletcher, Xavier Pennec (2020) Introduction to differential and Riemannian geometry. Academic Press.
- Xavier Pennec (2020) Manifold-valued image processing with SPD matrices. Academic Press.
- Kevin P. Murphy (2022) Probabilistic Machine Learning: An Introduction. MIT Press.
- Tom Fletcher (2020) Statistics on manifolds. Academic Press.
- Alexandre Barachant, Quentin Barthélemy, Jean-Rémi King, Alexandre Gramfort, Sylvain Chevallier, Pedro L. C. Rodrigues, Emanuele Olivetti, Vladislav Goncharenko, Gabriel Wagner vom Berg, Ghiles Reguig, Arthur Lebeurrier, Erik Bjäreholt, Maria Sayu Yamamoto, Pierre Clisson, Marie-Constance Corsi, Igor Carrara, Apolline Mellot, Bruna Junqueira Lopes, Brent Gaisford, Ammar Mian, Anton Andreev, Gregoire Cattan, Arthur Lebeurrier (2025) pyRiemann. Zenodo.






Top comments (0)