Jump to content

User Reference:P300Classifier

From BCI2000 Wiki
Revision as of 20:02, 27 August 2009 by Cmpotes (talk | contribs)

Synopsis

The P300 Classifier GUI (Graphical User Interface) is a tool that allows to train and test a linear classifier for detection of evoked related potentials collected with BCI2000. This GUI is designed for the analysis of BCI2000 data collected using the P3Speller or Stimuli Presentation paradigms. The program generates feature weights derived via the Stepwise Linear Regression technique. The specifics of the feature space and training routine can be manipulated using the GUI. The feature weights derived from the GUI can be saved and imported into BCI2000 as a parameter file fragment for online testing. The GUI provides the following functionality to investigators:

Classifier Training
Generates feature weights from BCI2000 P3Speller or Stimuli Presentation data files
Classifier Testing
Applies current feature weights to BCI2000 P3Speller or Stimuli Presentation data files and compares the results

Location

http://www.bci2000.org/svn/trunk/src/private/Tools/P300_classifier

Versioning

Author

Cristhian Potes

Source Code Revisions

  • Initial development: --
  • Tested under: --
  • Known to compile under: --
  • Broken since: --

Control Panel

The P300 Classifier GUI is composed of three panels: Data, Parameters, and Details.

Data Pane

Data Pane allows the user to:

  • Load training and testing data files and an INI file.
  • Generate and apply feature weights
  • Write a parameter file fragment
Data pane


  • [1] Load Training Data Files: Use this button to load BCI2000 data files for classifier training. The information for the selected files will appear at the top of the button.
  • [2] Load Testing Data Files: Use this button to load BCI2000 data files for classifier testing. The information for the selected files will appear at the top of the button. Training and testing data files must be compatible.
  • [3] Load Ini File: Use this button to load an INI file with all the parameters needed for the feature extraction.
[Initialization]

maxiter = 60 // to set the Max Model Features
penter = 0.1000 // to set the Penter
premove = 0.1500 // to set Premove
spatial_filter = 1 // to set the Spatial Filter. Set 1 for RAW and 2 for CAR
decimation_frequency_Hz = 20 // to set the  Decimation Frequency
channel_set = 1 2 3 4 5 6 7 8 // to set the Channel Set
Resp_window_ms = 0 800 // to set the Response Window
  • [4] Generate Feature Weights: Use this button to generate the feature weights after properly configuring all of the parameters in the Parameters pane. The suggested name for the parameter file fragment (*.prm) will appear at the top of the Write *.prm File button. This button will be enable only if the parameters are properly configured and there exists training data files.
  • [5] Apply Feature Weights: Use this button to test the classification accuracy of the parameter file fragment currently stored in the GUI. The classification results will appear in the Details pane.
  • [6] Write *.prm File: Use this button to save the parameters file fragment with the name suggested at the top of this button. The *.prm file is a BCI2000 parameter file fragment that can be imported into BCI2000 for online testing of the feature weights.

Parameters Pane

Parameters Pane contains all the parameters needed to generate the feature weights. These parameters can be loaded using the Load Ini File button. If the parameters are properly configured the Generate Feature Weights button is enabled.

Parameters pane
  • [7] Max Model Features: Used to specify the maximum number of features to be kept in the SWLDA (Stepwise Linear Discriminant Analysis model). Only a single value can be entered for evaluation. The defaults is 60.
  • [8] Penter: Used to specify the maximum p-value for a variable to be entered. The default is 0.1000. Penter must be less than Premove and 0<Penter<1. Only a single value can be entered for evaluation.
  • [9] Premove: Used to specify the maximum p-value for a variable to be removed. The default is 0.1500. Premove must be greater than Penter and 0<Premove<1. Only a single value can be entered for evaluation.
  • [10] Spatial Filter: Selects the spatial filter applied to the training data. Select RAW or CAR from the drop-down menu. RAW is no spatial filter applied to the data, and CAR is a common average reference filter using all of the channels contained in the data file (not just the channels specified in the GUI channel set). The default is RAW.
  • [11] Decimation Frequency: Used to specify the temporal decimation frequency of the data in Hz. Only a single value can be entered for evaluation. Set this parameter to the Sampling Rate value for no decimation. The lower the Decimation Frequency, the less original data retained for processing.
  • [12] Channel Set: Used to specify the channel set that will be used to create feature weights. The specified channels must be a subset of the channels contained in the training data file.
  • [13] Response Window: Used to specify the Begin and End time points in milliseconds (ms) following the stimuli collected for the analysis. These two values are automatically converted into samples according to the sampling rate of the data (rounded). Only a single data window can be entered and will be evaluated. Begin must be less than End.


Details Pane

Details Pane displays information about the BCI2000 training data files and the classification results.

Details pane
  • [14] Sampling Rate: Displays the sampling rate in (Hz) contained in the training data files.
  • [15] Number of Channels: Displays the total number of channels contained in the training data files.
  • [16] Number of Classifier: Displays the classifier applied to generate the feature weights.
  • [17] Application: Displays the type of application used for the investigator. The application can be either P3SpellerTask or StimulusPresentationTask.
  • [18] Interpret Mode: Displays the interpret mode used for the investigator. The mode can be either Copy Mode or Online Free Mode.
  • [19] Duration: Displays the duration in (s) of the whole training data files.
  • [20] The text editor displays the classification results for the training and testing data files.


Methodology

Methodology Concept

The idea behind the P300Classifier is to train and test a linear classifier (SWLDA) for detection of evoked potentials collected from brain signals. This is achieved in five steps for training data and in four steps for testing data.

  • Training Data Files
  1. Load BCI2000 data files
  2. Get P300 responses
  3. Generate feature weights for a linear model using SWLDA
  4. Apply linear classifier to get scores
  5. Interpret scores according to the given application
  • Testing Data Files
  1. Load BCI2000 data files
  2. Get P300 responses
  3. Apply linear classifier to get scores
  4. Interpret scores according to the given application


Methodology Step By Step

Step 1: Load BCI2000 data files

The first step of the P300Classifier GUI is to load the training and testing BCI2000 data files specified by the investigator. The BCI2000 data files are checked for compatibility and consistency. If the training data files are valid then the Generate Feature Weights button is enable. Each file is colored according to the following color coded scheme:

  • files ok : The files are valid.
  • files mismatch : The files may be valid but there is a mismatch with another file.
  • files error : The files are invalid.

Step 2: Get P300 responses

Signals, states, and parameters are extracted from the BCI2000 data files. However, the signals that are only extracted are those defined by the user in the response window. Only these signals are filtered and downsampled. The filter employed is a Moving Average Filter implemented as a Direct form II Transposed. The downsampling factor is computed as:

SamplingRateDecimationFrequency

Step 3: Generate feature weights for a linear model using Stepwise Linear Discriminant Analysis (SWLDA)

The idea behind SWLDA is to use specific statistical procedures for selecting the best variables in a linear regression. In each step, there is a re-examination of the previous variables incorporated into the model. The SWLDA algorithm can be summarized in the following three steps:

  • STEP 1: Compute the autocorrelation matrix to select the variable most highly correlated to the response. The selected variable is included in the linear model.
  • STEP 2: Control the inclusion and exclusion of variables in the linear model by using F-tests.
  • STEP 3: Perform a linear regression equation with the included variables using least squares.


Step 4: Apply linear classifier to get scores

Scores are computed based on the final variables included in the linear model and the corresponding feature weights.

Step 5: Interpret scores

Scores are interpreted according to the given application, which can be either P300SpellerTask or StimulusPresentationTask.

Tutorial

Training a Classifier

The Details panel contains all of the parameters for generating SWLDA classifier weights from BCI2000 data files.

To generate SWLDA weights, the investigator must be

  • Press the Load Training Data Files [1] button in the Data panel.
  • From the dialog box, select the desire BCI2000 *.dat file(s) for training. Selected files can be from different sessions of the same paradigm but must contain consistent parameters. Each file is colored according to the color coded scheme explained in Load BCI2000 data files

See also