Common Spatial Patterns: the classic motor imagery filter

CSP finds channel combinations whose variance differs most between two classes. Log-variance of those few filtered signals is often all a linear classifier needs.

Updated

Motor imagery changes band power, which is variance in a band-passed signal, and the change is spatially specific. CSP exploits both. It solves a generalised eigenvalue problem on the two class covariance matrices and returns spatial filters ordered from "high variance for class A, low for class B" to the reverse. The filters at both ends are the discriminative ones.

Taking the log-variance of the signal through the first and last few filters gives a short feature vector, typically 4–6 numbers, that feeds LDA or an SVM. This pipeline has been the standard motor imagery baseline for two decades.

Variants

  • Regularized CSP

    Shrinks covariance estimates towards a stable target. Use it when trials are few or data is noisy, where plain CSP overfits.

  • Sparse CSP

    Constrains filters to few channels, which is more interpretable and needs fewer electrodes.

  • Filter-bank CSP (FBCSP)

    CSP in several frequency bands, then feature selection across bands, so the best band is learned per subject.

  • Multiclass

    One-versus-rest or pairwise CSP extends the two-class method to four-class motor imagery.

CSP is fitted, so it leaks

CSP learns from labels. Fitting it on the whole dataset before cross-validation means the filters have seen the test trials, and the reported accuracy is optimistic, often by a wide margin. CSP belongs inside the model that the trainer refits per fold, not upstream of the split.

CSP in BCILattice

CSP appears in three places. It is a spatial feature family in Feature Extraction. It is a channel selection method, with Regularized CSP and Sparse CSP alongside it, recommended for left- versus right-hand motor imagery. And it is a block in the BCI decoding family on the ML canvas, together with SPoC, Xdawn and SSD. Wired into a trainer with a Validation Scheme, it is refitted on every fold.

Questions

What is Common Spatial Patterns in EEG?

CSP is a supervised spatial filtering method that finds linear combinations of EEG channels whose variance is maximal for one class and minimal for the other. It is the classic feature extractor for motor imagery BCIs.

How many CSP filters should I use?

Usually two or three from each end of the sorted filters, giving four to six features. More filters add noise faster than information.

What is FBCSP?

Filter-bank CSP applies CSP in several frequency bands and selects the most discriminative band-filter pairs. It adapts to each subject's frequency profile and performed best in BCI Competition IV dataset 2a.

Is CSP better than Riemannian methods?

Riemannian classifiers on covariance matrices often match or beat CSP and are less sensitive to tuning. CSP remains a strong, interpretable baseline. Compare both under the same grouped evaluation.

Read the reference

Related

Run a study end to end, on your own machine

The free plan covers two studies, the full analysis suite, and 118 of the 119 ML blocks.