Common Spatial Pattern

Simulation
Introduced by
Herbert Ramoser
Year
2000
Type
Spatial filtering and feature extraction
Family
Signal processing

What does it do?

Common Spatial Pattern (CSP) is a supervised spatial filtering method for multichannel EEG.

It computes channel weightings whose filtered signals have a high variance ratio between two classes of activity, and it is most often used to extract features for motor imagery brain-computer interfaces (BCIs). Ramoser and colleagues applied CSP to single-trial EEG recorded during imagined left- and right-hand movement in 2000, and it has since become a common feature extraction step in BCI work.

The intuition behind the method

When a subject imagines moving the left hand or the right hand, the spatial pattern of cortical activity over the scalp changes in a class-dependent way. CSP looks for linear combinations of electrodes, each defining a spatial filter, for which the variance of the filtered signal is high for one class and low for the other. Each electrode is weighted by its contribution to this separation, so the filters can be inspected as spatial maps. Projecting each trial through these filters concentrates the class-discriminative information in a few signals, which a simple classifier can then use.

History

CSP was applied to single-trial EEG for motor imagery brain-computer interfaces by Ramoser and colleagues in 2000, using data from left- and right-hand imagery; the best classification results for the three subjects were 90.8%, 92.7% and 99.7%. Koles and colleagues had earlier studied the spatial patterns underlying population differences in the background EEG, and their work is cited alongside the CSP study.

When to use it

Choose CSP for two-class EEG problems in which the classes differ in the spatial distribution of band-limited power, such as left- versus right-hand motor imagery, and where labelled training trials are available for each class. It suits designs in which a classifier is trained offline on a calibration session and then applied to new trials. Avoid CSP when there are more than two classes without a multi-class extension, when labels are unavailable (CSP is supervised), or when the recording conditions change so much between sessions that filters estimated on one session will not transfer. The number of trials per class needs to be large enough that the class covariance matrices are estimated reliably. When trials are few relative to the number of channels, the covariance estimates become unstable; in that case consider regularization or a reduction in the number of channels, and check whether the filters are stable across resamples of the trials.

Limitations and considerations

  • Covariance estimates need enough trials per class to be reliable; with few trials, the eigenvectors can be dominated by estimation noise.
  • Assumes that the spatial covariance structure of each class is stable within the calibration session; drift between sessions or within a trial violates this assumption and degrades the filters.
  • Defined for two classes; extensions to multi-class problems exist but are less direct and need more careful design and tuning.
  • The filters are only as good as the labels and the chosen frequency band; because CSP is supervised, mislabelled or noisy trials bias the estimated patterns.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Weights each electrode by its contribution to separating the two classes, so the resulting spatial filters can be inspected as channel-level maps.
  • Requires only linear algebra on covariance matrices (a generalized eigenvalue problem), which keeps computation and per-trial filtering simple enough for online use.
  • Uses class labels to select the filters, so the features target class differences rather than the largest overall variance in the recording.
  • In the original study on three subjects with left- and right-hand imagery, the best classification results were 90.8%, 92.7% and 99.7%, and the authors presented the method as a promising approach for EEG-based brain-computer interfaces.

Applications

  • Brain-computer interface design: CSP features computed from motor imagery trials can be passed to a classifier to distinguish imagined left- and right-hand movements for control tasks.
  • Research on imagined movement: CSP can be used to identify which electrodes contribute most to separating two imagery conditions, supporting analysis of where the discriminative activity lies on the scalp.

How it works

How it works

1

Record multi-channel EEG during two classes of motor imagery (e.g., left-hand vs right-hand imagination); segment data into trials of equal duration (e.g., 3 seconds post-cue).

2

Band-pass filter the trials to the frequency band relevant to motor imagery (the mu and beta rhythms are the usual focus); remove outlier trials and artifacts.

3

For each trial, estimate the spatial covariance matrix of the channels, normalised by its trace so that trials of different overall amplitude contribute comparably. For each class, average the covariance matrices of its trials. These two class matrices summarise how the channels co-vary within each class.

4

Solve the generalized eigenvalue problem for the two class covariance matrices. The eigenvectors are the spatial filters, and their eigenvalues indicate how strongly each filter favours one class over the other, so filters at the two ends of the spectrum are the most discriminative. Retain a small number m of patterns (commonly 2 to 4 for two-class problems, selected by validation).

5

Project each raw trial onto the selected spatial filters, compute the variance of each filtered signal (usually log-transformed) and use these log-variance values as features for a classifier. To read the result, inspect the spatial filter weights as channel-level maps and check whether the electrodes that contribute most lie over regions consistent with the expected motor activity. Ramoser and colleagues describe one-sided hand imagery as producing EEG changes at contralateral and ipsilateral central areas, and they interpret the spatial filters as reflecting the specific activation of cortical areas. Report classification accuracy from cross-validation, compared against the chance level for two classes (50%), together with the number of trials per class and the frequency band used.

Common pitfalls

  • Choosing m is a trade-off: keeping only one filter may discard useful discriminative information, while keeping many filters increases the risk of overfitting. Select m with cross-validation rather than by eye.
  • Ill-conditioned covariance matrices, which arise when channels are many relative to trials, cause numerical instability in the eigendecomposition; shrinkage or other regularization of the covariance estimates is usually needed.
  • Estimating the filters and reporting accuracy on the same trials inflates performance; the spatial filters should be fitted within each training fold of a cross-validation scheme.
  • Training on one session and testing on another without accounting for non-stationarity can reduce accuracy substantially; adaptive estimation or periodic retraining of the filters is a common response.

Frequently asked questions

What is the relationship between CSP and principal component analysis (PCA)?

PCA finds directions of maximum variance without considering class labels; CSP finds directions that maximize the ratio of variance between two classes. CSP is supervised, PCA is unsupervised.

How many CSP filters should I use?

For two-class problems a small number is usually retained, often drawn from both ends of the eigenvalue spectrum, because those filters are the most discriminative. Select the number by cross-validation; more filters are not always better, because they add parameters that can overfit.

Can CSP be applied to single-trial real-time BCI?

Yes. Once the filters are estimated offline, each new trial is projected onto them, the variance of each filtered signal is computed and the resulting features are passed to a classifier, typically LDA. The per-trial computation is light, but preprocessing and classification must also run within the real-time loop, and the filters may need recalibration if the recording conditions change.

Related methods

Sources

  1. Ramoser, H., Mueller-Gerking, J., & Pfurtscheller, G. (2000). Optimal spatial filtering of single trial EEG during imagined hand movement. IEEE Transactions on Rehabilitation Engineering, 8(4), 441-446.

    Open DOI reference
  2. Koles, Z. J., Lazar, M. S., & Zhou, S. Z. (1991). Spatial patterns underlying population differences in the background EEG. Brain Topography, 2(4), 275-284.

    Open DOI reference