CSP Spatial Filter Trainer


  • Plugin name : CSP Spatial Filter Trainer
  • Version : 1.0
  • Author : Dieter Devlaminck
  • Company : Ghent University
  • Short description : Computes spatial filter coeffcients according to the Common Spatial Pattern algorithm.
  • Documentation template generation date : Apr 11 2018


The CSP algortihm increases the signal variance for one condition while minimizing the variance for the other condition.

This box computes spatial filters according to the Common Spatial Pattern algorithm. The goal of the algorithm is to improve the discrimination of two types of signals. The spatial filters are constructed in a way they maximize the variance for signals of the first condition while at the same time they minimize it for the second condition. This can be used for discriminating the signals of two commonly used motor-imagery tasks (e.g. left versus right hand movement). It can also be used for two-class SSVEP experiments or any other experiment where the discriminative information is contained in the variance (or power in a certain band) of the signal conditions.

Please note that this implementation computes a trace normalization.


1. Stimulations

This stimulus input is needed to indicate the end of a recording session (or end of file). It then triggers the training/computation of the CSP filters.

  • Type identifier : Stimulations (0x6f752dd0, 0x082a321e)

2. Signal condition 1

This input expects epoched data for the first condition (e.g. epochs for left hand motor imagery).

  • Type identifier : Signal (0x5ba36127, 0x195feae1)

3. Signal condition 2

This input expects epoched data for the second condition (e.g. epochs for right hand motor imagery).

  • Type identifier : Signal (0x5ba36127, 0x195feae1)


1. Train-completed Flag

The xDAWN Trainer outputs the stimulation OVTK_StimulationId_TrainCompleted when the training process was successfull. No output is produced if the process failed.

  • Type identifier : Stimulations (0x6f752dd0, 0x082a321e)


1. Train Trigger

This should contain the stimulus identifier denoting the end of a recording session or end of file, e.g. OVTK_GDF_End_Of_Session or OVTK_StimulationId_ExperimentStop.

  • Type identifier : Stimulation (0x2c132d6e, 0x44ab0d97)
  • Default value : [ OVTK_GDF_End_Of_Session ]

2. Spatial filter configuration

This setting contains the path and filename of the configuration file in which the computed spatial filters are saved.

  • Type identifier : Filename (0x330306dd, 0x74a95f98)
  • Default value : [ ]

3. Filter dimension

Here you need to determine how many spatial filters will be computed (default value is two).

  • Type identifier : Integer (0x007deef9, 0x2f3e95c6)
  • Default value : [ 2 ]

4. Save as box config

If true, the output file will be a box configuration XML. Otherwise it will be a text format matrix.

  • Type identifier : Boolean (0x2cdb2f0b, 0x12f231ea)
  • Default value : [ true ]


Before training the spatial filter you should first filter the data with respect to the desired band (e.g. for motor imagery, certain people display good results in a narrow pass-band of 8-12Hz, others in 8-30Hz). As in the example scenario below, one could also opt for different pass-bands and compute filters in each of them, finally letting the subsequently trained classifier decide which features are important.

Example scenario to compute CSP filters

Once the spatial filters are computed and saved in the configuration file, you will need to load it into the Spatial Filter box.


For the moment it is only implemented for two classes. Multiple classes can be supported in the future according to an all-versus-one scheme or through joint diagonalization.