BCI2000 Classifier

Forum for software developers to discuss BCI2000 software development
Locked
saimrasheed
Posts: 18
Joined: 08 Jul 2009, 12:38

BCI2000 Classifier

Post by saimrasheed » 05 May 2010, 10:55

Hi,
I have recorded 4 channels EEG signals in a single *.dat file for three different visual stimulus conditions (say, V1, V2 and V3) for several subjects. The file contains, few less than 60 trials for each condition, using BCI2000’s ‘StimulusPresentation_gMOBIlabPlus.bat’ file, sampled at 256 Hz.
1) Is it possible to use the existing classifier in BCI2000 to classify brain's response into three different classes (V1, V2 or V3) such that, once the classifier is trained then every new stimulus trial (of any of the conditions presented) could be classified as a seperate class?
2) How much data is required to train BCI2000 classifier?
3) How to implement a new classifier(say, SVM) offline/online, in case, if existing classifier do not work for such classification?
4) How to display output of classifier in application module, i.e. Brain's response belongs to which class (V1, V2 or V3)?
5) As an option, Is it possible to integrate LIBSVM (http://www.csie.ntu.edu.tw/~cjlin/libsvm/) into BCI2000? or BCI2000's data could be used in LIBSVM?
Thanking you in advance.
Regards

mellinger
Posts: 1065
Joined: 12 Feb 2003, 11:06

Post by mellinger » 06 May 2010, 09:14

Hi,

I could help you better if I knew which type of paradigm you were using when recording your data. Was it an Evoked Response (ERP/P300) paradigm, or an Event Related Desynchronization (ERD/mu rhythm) paradigm? I.e., are you expecting to see different wave forms in response to different stimuli, or a difference in the amplitude of certain brain rhythms?
1) Is it possible to use the existing classifier in BCI2000 to classify brain's response into three different classes (V1, V2 or V3) such that, once the classifier is trained then every new stimulus trial (of any of the conditions presented) could be classified as a seperate class?
Yes, this would be possible. Depending on the kind of signal difference you expect, you could do pairwise classification between each pair of classes, and output the results in three output channels of the LinearClassifier, or you would use only a single output channel of the LinearClassifier, and project three classes onto that single channel.
2) How much data is required to train BCI2000 classifier?
The amount of data required for classifier training depends on the method used to train the classifier, not on the classifier itself. The LinearClassifier filter in BCI2000 implements generic linear classification, and may be trained using any training method suited for linear classifiers, e.g. standard Linear Discriminant Analysis. For the SWLDA method implemented in BCI2000's P300Classifier for ERP data, a few dozen trials for each class will suffice. For manual classifier configuration with either ERD or ERP data, BCI2000's OfflineAnalysis program will output useful information for about the same amount of data.
3) How to implement a new classifier(say, SVM) offline/online, in case, if existing classifier do not work for such classification?
If the new classifier is linear, you will only need to implement its offline training method, and use the result to configure BCI2000's LinearClassifier. In case of a different classifier, you will need to implement a replacement of the LinearClassifier filter. Please read the BCI2000 tutorial on writing BCI2000 filters to learn how to do this.
4) How to display output of classifier in application module, i.e. Brain's response belongs to which class (V1, V2 or V3)?
This depends very much on the nature of your signal, and the features derived from it. For three classes, you might display a triangle, and a white dot representing the classification distance to each of the triangle's vertices. For ERD data, a typical representation of the control signal is a ball's velocity in X, Y, and Z direction, and the ball approaches different targets depending on the classification result (see the BCI2000 CursorTask for examples). For ERP data, a typical representation of the classification result is a repetition of the classified stimulus (in the BCI2000 StimulusPresentationTask), or a speller action such as entering a selected letter into a text field (as in the BCI2000 P3Speller application).
5) As an option, Is it possible to integrate LIBSVM (http://www.csie.ntu.edu.tw/~cjlin/libsvm/) into BCI2000? or BCI2000's data could be used in LIBSVM?
Yes, this is possible. You would need to write your own classification filter, as suggested above.
--Juergen

saimrasheed
Posts: 18
Joined: 08 Jul 2009, 12:38

Post by saimrasheed » 07 May 2010, 06:15

Thankyou very much Juergen for your detailed response.
Was it an Evoked Response (ERP/P300) paradigm, or an Event Related Desynchronization (ERD/mu rhythm) paradigm?
I presented(3 seconds duration) three different visual stimuli at random and each condition was presented 60 times(so got 60 trials, only 5 dozen, enough for training or need more?) to see Visual Evoked Response. The subject was supposed only to fixate his gaze at the stimuli.
are you expecting to see different wave forms in response to different stimuli, or a difference in the amplitude of certain brain rhythms?
Any differences, my ultimate target is to classify the brain's response against three visual conditions (V1, V2 and V3).
1) Is it possible to use the existing classifier in BCI2000 to classify brain's response into three different classes (V1, V2 or V3) such that, once the classifier is trained then every new stimulus trial (of any of the conditions presented) could be classified as a seperate class?

Yes, this would be possible. Depending on the kind of signal difference you expect, you could do pairwise classification between each pair of classes, and output the results in three output channels of the LinearClassifier, or you would use only a single output channel of the LinearClassifier, and project three classes onto that single channel.
I think, it would be better to project three classes onto single channel in order to compare one condition's response against all the other. However, it is not necessary. The other approach doing pairwise classification would also be ok. I dont know the complexity of each so would prefer to follow the one which is simpler and easy.
2) How much data is required to train BCI2000 classifier?

The amount of data required for classifier training depends on the method used to train the classifier, not on the classifier itself. The LinearClassifier filter in BCI2000 implements generic linear classification, and may be trained using any training method suited for linear classifiers, e.g. standard Linear Discriminant Analysis. For the SWLDA method implemented in BCI2000's P300Classifier for ERP data, a few dozen trials for each class will suffice. For manual classifier configuration with either ERD or ERP data, BCI2000's OfflineAnalysis program will output useful information for about the same amount of data.
If I am not wrong, SWLDA P300Classifier is configured for two classes(target and non-target) or I can also use P300Classifier for this purpose like I used it earlier in running P3Speller application i.e. With default parameters of linear classifier matrix, First run speller application data file was given input to P300Classifer and output was saved as *.prm and then used by loading parameters which filled all the columns and rows of Linear Classifier matrix, made the classifier trained and from second run user was able to spell correctly. Can I use SWLDA P300Classifier for my task, by making any changes in it? How and where to take start from? Based on your experience, Do you recommend SWLDA or SVM for my task, I do not have enough experience, your suggestions valued me a lot.
3) How to implement a new classifier(say, SVM) offline/online, in case, if existing classifier do not work for such classification?

If the new classifier is linear, you will only need to implement its offline training method, and use the result to configure BCI2000's LinearClassifier. In case of a different classifier, you will need to implement a replacement of the LinearClassifier filter. Please read the BCI2000 tutorial on writing BCI2000 filters to learn how to do this.
Probably, here is the answer of my above question... that I only need to implement a method like P300Classifier, which I can use for offline training, in case if linear classifier is decided. Implementing a replacement of LinearClassifier filter would make the task more complex in adition to implementation of classifying method, please suggest keeping the task simpler...

Many Thanks Once again...

mellinger
Posts: 1065
Joined: 12 Feb 2003, 11:06

Post by mellinger » 07 May 2010, 08:57

If you want to see a Visually Evoked Response, you are following an ERP paradigm, and expect different wave forms in response to different stimuli. However, in an ERP paradigm, you would typically classify whether the subject attends a certain stimulus (which is a two-class problem) rather than classify between a number of stimuli.
. Can I use SWLDA P300Classifier for my task, by making any changes in it?
If you want to do ERP classification between three stimuli, you could use the P300Classifier program to give you parameters suited for pairwise classification between any two stimuli, and then enter the parameters into a single classifier matrix, with the OutputChannel column adapted such that each pairwise classifier will output into a different channel. Then, write an application module that can handle the three outputs to decide on a single classification result.
Based on your experience, Do you recommend SWLDA or SVM for my task, I do not have enough experience, your suggestions valued me a lot.
Unless you have some experience with SVMs, I would suggest that you stick to linear classification, beginning with standard LDA, and trying SWLDA.
--Juergen

Locked

Who is online

Users browsing this forum: No registered users and 2 guests