From Vol I features to the covariance matrix
In Vol I you decoded motor imagery by band-passing the sensorimotor rhythm, learning CSP spatial filters, taking the log-variance of the filtered channels, and feeding those to an LDA. That pipeline works, but it is a chain of tuned, class-specific choices: which band, which filters, how many, how to regularize. This track rebuilds motor-imagery decoding on a single, geometry-first object that quietly contains all of it.
That object is the spatial covariance matrix of a trial. Given a band-passed epoch X \in \mathbb{R}^{n \times N} (n channels, N time samples), its sample covariance summarizes how every pair of electrodes co-varies during the trial.
C = \frac{1}{N-1} X X^{\top}, \qquad C \in \mathbb{R}^{n \times n}, \; C = C^{\top}, \; C \succ 0The sample spatial covariance of one band-passed trial — symmetric and (given enough samples) positive-definite.
Summarize a trial not by its raw waveforms but by how its channels co-vary — which pairs of electrodes rise and fall together. That summary is a symmetric, positive-definite matrix.
- X
- The band-passed trial (channels by time samples).
- C
- The spatial covariance matrix summarizing the trial.
- N
- Number of time samples; N-1 makes the estimate unbiased.
- C \succ 0
- Positive-definite — every variance is genuinely positive.
This covariance feature is what the whole Riemannian chapter operates on; see spatial covariance estimation.
The trap: treating covariances as vectors
The obvious move is to flatten C into a n^2-vector (or its n(n+1)/2 upper triangle), then use Euclidean distance and the arithmetic mean like any other feature. Distance and mean are the two operations every classifier needs — nearest-mean, LDA, k-NN, all of them. So the question is: is the straight-line Euclidean distance the right distance between two covariance matrices?
\delta_E(C_1, C_2) = \lVert C_1 - C_2 \rVert_F = \Big( \sum_{i,j} (C_1 - C_2)_{ij}^2 \Big)^{1/2}The Euclidean (Frobenius) distance treats the matrix as a flat bag of numbers — it ignores the positive-definite constraint entirely.
The naive way to compare two covariance matrices is to subtract them entry by entry and measure the leftover. But that treats each matrix as a flat bag of numbers and ignores that covariances live on a curved surface.
- \delta_E(C_1, C_2)
- The Euclidean (Frobenius) distance between the two matrices.
- C_1, C_2
- The two covariance matrices being compared.
- \lVert \cdot \rVert_F
- Frobenius norm: the root of the summed squared entries.
It is quick and familiar, but as the next block shows it distorts averages and biases variance upward.
The answer is no, for two concrete reasons. First, SPD matrices form an open convex cone, not a full vector space: subtract two of them and you can land outside the cone (an indefinite matrix that is not a valid covariance). Second, the Euclidean average suffers a swelling effect — its determinant (a proxy for total variance / signal power) is inflated above that of the true geometric mean, so Euclidean-averaged covariances look artificially 'louder' than any trial that produced them.
\det\!\Big( \tfrac{1}{2}(C_1 + C_2) \Big) \; \ge \; \sqrt{\det C_1 \, \det C_2} \; = \; \det(G)Swelling: the Euclidean midpoint's determinant exceeds that of the geometric mean G — a systematic upward bias in apparent variance.
Averaging two covariance matrices the flat way inflates the apparent spread: the straight-line midpoint always has a bigger determinant (volume) than the true geometric mean. That built-in bias is called swelling.
- \det(\cdot)
- The determinant — a measure of total variance or volume.
- \tfrac{1}{2}(C_1 + C_2)
- The flat, Euclidean average of the two matrices.
- G
- The geometric mean — the correct, non-swelling midpoint.
Interpolate between two elongated ellipses and the Euclidean midpoint bulges out fatter than either endpoint unless you use the geometric mean.
The manifold viewpoint
The fix is to stop pretending the space is flat. The set of n \times n SPD matrices is a smooth, curved Riemannian manifold: a surface on which distances are measured along the shortest curves that stay on the surface (geodesics), not along straight chords that cut through forbidden territory. On this manifold, averaging follows the curvature and the swelling disappears — the geometric mean is the natural centre.
The single property that makes this worth the trouble is affine invariance, which the next guide develops in full: the natural manifold distance is unchanged if every covariance is mapped by the same invertible linear transform of the sensors. Re-reference the EEG, rescale channel gains, mix electrodes through an unknown lead field — the geometry does not notice. That invariance is exactly what a signal buried under session-to-session and subject-to-subject nuisance variation needs, and it is why Riemannian methods transfer.
What this track will build
The payoff, developed over the next four guides: a decoder with essentially no hyperparameters (guide 3's MDM), a way to unlock the full machine-learning toolbox on manifold features (the tangent-space trick), and near-free cross-session and cross-subject transfer by re-centering the manifold (guide 4). Guide 5 takes you to the research edge — geometry-aware neural networks, alternative metrics, and the honest limits of the paradigm.