Common Spatial Patterns (CSP) for two-class discriminative spatial filtering of band-passed M/EEG. More...


Go to the source code of this file.
Classes | |
| class | DECODINGLIB::DecodingCsp |
| Common Spatial Patterns decoder for two-class discriminative spatial filtering. More... | |
Namespaces | |
| namespace | DECODINGLIB |
| Supervised and unsupervised spatial-filter decompositions for M/EEG decoding. | |
Common Spatial Patterns (CSP) for two-class discriminative spatial filtering of band-passed M/EEG.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
CSP finds spatial filters \(w\) that maximise the variance of narrow-band M/EEG for one class while simultaneously minimising it for the other; equivalently, it diagonalises the per-class covariance matrices \(\Sigma_1\) and \(\Sigma_2\) jointly via the generalised eigenvalue problem \(\Sigma_1 w = \lambda (\Sigma_1 + \Sigma_2) w\). The components with the largest and smallest eigenvalues carry the strongest class-discriminative band-power and form the standard 2-class motor imagery feature set used since Koles (1990) and popularised for BCI by Blankertz, Tomioka, Lemm, Kawanabe & Müller, Optimizing Spatial Filters for Robust EEG Single-Trial Analysis, IEEE Signal Processing Magazine 25(1), 2008.
DecodingCsp mirrors the public surface of mne.decoding.CSP but implements the GED inline with Eigen so no LAPACK dependency is required, which matters for the WebAssembly target. Beyond the upstream algorithm it provides the TransformMode switch (AveragePower returns one log- or z-scored band-power feature per component and epoch; CspSpace returns the time-resolved projection), the closed-form inverseTransform back to sensor space via the patterns matrix, and persistent mean / stddev vectors for cross-session normalisation. Inputs are always epoched and already band-passed in the discriminative frequency range — CSP itself is purely spatial.
Definition in file decoding_csp.h.