JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Robustness and Transfer: Re-centering, the Potato, and the Log-Euclidean Shortcut

The payoff that made Riemannian methods famous: near-free cross-session and cross-subject transfer by re-centering the manifold, unsupervised online artifact rejection with the potato, and a cheap metric for real-time use.

The non-stationarity problem

The chronic curse of EEG decoding is that the signal does not sit still. Between one day and the next — or one subject and another — electrode impedances drift, the montage shifts a millimetre, the person is more or less alert. Statistically this is covariate shift: the distribution of features moves even when the task is unchanged, and a decoder trained yesterday quietly rots today. Classically you fought this with lengthy recalibration at the start of every session.

Riemannian geometry offers a startlingly cheap fix for the dominant part of this drift — a shift in the mean of the covariance distribution — and it needs no labels at all.

Riemannian alignment (re-centering)

The idea is one line of geometry. Compute the Fréchet mean of a session's covariances, then whiten every covariance by that mean. This maps each session so that its mean becomes the identity — the origin of the manifold. Do it to every session or subject and their clouds now overlap at a common centre.

\tilde{C}_i = \bar{C}^{-1/2} \, C_i \, \bar{C}^{-1/2}, \qquad \text{so that} \quad \operatorname{Fr\acute{e}chet\text{-}mean}\{ \tilde{C}_i \} = I

Re-centering: whiten every trial by the session's own Fréchet mean so all sessions share the identity as their centre.

Different sessions and subjects drift to different "centers." Whiten every trial by its own session's mean so each session is re-centered on the identity — now a decoder trained on one session fits another.

\bar{C}
The session's own Fréchet mean covariance.
\bar{C}^{-1/2}
Its inverse square root — the whitening transform.
\tilde{C}_i
The re-centered trial covariance.
I
The identity — the shared new center for all sessions.

This Riemannian alignment is one of the simplest, strongest tricks for cross-session transfer.

Because AIRM is affine-invariant, this whitening does not distort within-session geometry at all — it only slides the whole cloud to the origin. A decoder trained on re-centered data from one session or subject now applies to re-centered data from another with little or no calibration. This is the core of Riemannian alignment and of manifold transfer learning, and crucially it is unsupervised: computing a session's mean needs only its unlabeled covariances.

Use the widget to feel re-centering: shift one class cloud off-centre (a 'new session') and watch a Euclidean classifier fail while the Riemannian one, after whitening to the identity, still separates the classes.

The Riemannian potato: online quality control

The same geometry gives a beautifully simple online artifact detector. Compute the Fréchet mean of clean covariances and the spread of their distances to it. A new trial that lands too far from the mean — a jaw clench, a big eye movement, a loose electrode — is flagged and dropped. The 'good' region is a fuzzy blob on the manifold, which is why it is affectionately called the Riemannian potato.

z_i = \frac{\delta_R(C_i, \bar{C}) - \mu}{\sigma}, \qquad \text{reject the trial if } \; z_i > z_{\text{th}}

The potato criterion: a Riemannian z-score of each trial's distance to the mean; reject beyond a threshold (e.g. z_th ≈ 2.5).

A live quality filter: score each trial by how far — in Riemannian distance — it sits from the normal center, as a z-score. Trials that are freakishly far out are artifacts, so drop them.

\delta_R(C_i, \bar{C})
The Riemannian distance from a trial to the mean.
\mu,\ \sigma
The mean and spread of that distance on clean data.
z_i
The trial's z-score of distance.
z_{\text{th}}
The rejection threshold, e.g. about 2.5.

The Riemannian potato rejects any trial whose distance z-score exceeds the threshold.

It is unsupervised, needs no artifact templates, runs in real time, and — again thanks to affine invariance — does not need re-tuning when the montage or gains change. It is the standard first line of automatic quality control in Riemannian pipelines.

The log-Euclidean shortcut

AIRM's power costs compute: every distance and every Karcher iteration involves matrix square roots and inverses. For very fast online loops there is a cheaper metric. The log-Euclidean metric maps each covariance once through the matrix log into a flat space, where the mean is just the arithmetic average of the logs and the distance is a plain Frobenius norm — both closed-form, no iteration.

\delta_{LE}(C_1, C_2) = \lVert \log C_1 - \log C_2 \rVert_F, \qquad \bar{C}_{LE} = \exp\!\Big( \tfrac{1}{N} \sum_{i=1}^{N} \log C_i \Big)

Log-Euclidean distance and mean: one matrix log up front, then everything is linear algebra in the log domain.

A fast approximation: take the matrix log of every covariance once, and then all distances and averages become plain linear algebra in log-space. Cheaper than the full Riemannian metric while keeping most of the benefit.

\log C
The matrix logarithm, computed once per trial.
\delta_{LE}(C_1, C_2)
The log-Euclidean distance — a Frobenius distance in log-space.
\bar{C}_{LE}
The log-Euclidean mean: average the logs, then exponentiate back.
\exp(\cdot)
The matrix exponential that undoes the log.

The log-Euclidean metric loses affine invariance but runs far faster — ideal for real-time or very large sets.