Very simple valence & arousal identification

Forum for software developers to discuss BCI2000 software development
Locked
acampione
Posts: 10
Joined: 15 Nov 2013, 07:42

Very simple valence & arousal identification

Post by acampione » 07 Dec 2013, 07:52

Greetings,

I have never used BCI2000 before - as can be seen in the two other discussion I created in this section - so I am just a beginner.

I am reading "A Practical Guide to Brain-Computer Interfacing with BCI2000" by Gerwin Schalk and Jurgen Mellinger.

Until now (even if my first language is italian) I think I have understood almost everything is explained in the previous chapters.

Next chapter I am going to read is chapter 10.

I need to create, using BCI2000, something (a passive emotional BCI?) which allows an Emotiv Epoc neuroheadset (this is the device which most likely will be used for experimentation) to recognize valence & arousal (dimensional model of emotions).

Here is an example to explain what my goal is: some pictures will be shown to a test subject. There pictures will be different in their content. For example, there will be both relaxing and disturbing pictures.

The system I would like to create using BCI2000 should be able to identify the subject's emotion (in term of valence & arousal) each time a picture is shown, and, basing on the above mentioned emotion, decide which picture will be shown next.

For example the decision criterion may be: if the subject's emotion related to the last image was anxiety, the next image should evoke the opposite emotion. So a relaxing picture will be shown next.

I was told to use:

- Fast Fourier Transformate (FFT) as Filter
- Support Vector Machine as Classifier

I was also told that there already are libraries in BCI2000 for this purpose, so I should only find and "compose" them to obtain the above mentioned system.

Is there any tutorial to do such thing? Where can I find those modules I need?

I have never heard of FFT before.

Regarding Support Vector Machines, I attended a very introductory machine learning course at my university, so I know the very few BASICS things about them.

The system should be very very simple since, as I said, I am really a beginner with BCI2000 and an amateur programmer.

Therefore, it will be more than enough if the system will be able to do the things I mentioned before. Regarding FFT and SVM, I just need to know in general what they are and how they work. Nothing more.

Thanks in advance.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Very simple valence & arousal identification

Post by boulay » 09 Dec 2013, 22:18

While you are describing a problem for emotion classification, the techniques required are identical to those used in discriminating "motor imagery" vs "rest". Discriminating motor imagery from rest usually involves brain signals known as the "mu rhythm" or "sensorimotor rhythm" (SMR). If you look through the tutorials for motor imagery classification then you'll get most of the way there.

Some links that might help:
http://www.bci2000.org/wiki/index.php/U ... I_Tutorial
http://www.bci2000.org/wiki/index.php/U ... a_Analysis

I don't believe there are any tutorials on there for SVM. However, it's fairly straightforward to get your BCI2000 data into the Matlab toolbox called "EEGLAB" and from there "BCILAB". BCILAB has some built-in tools for SVM. I guess that you are doing this for school, and therefore you probably need to implement some this yourself, so instead you should use the Matlab tools that come with BCI2000 to load the raw data then do all of the feature extraction (including FFT) and offline classification (including SVM) yourself.

acampione
Posts: 10
Joined: 15 Nov 2013, 07:42

Re: Very simple valence & arousal identification

Post by acampione » 10 Dec 2013, 04:29

First of all, thanks for the support.

I will focus on those link you provided.

I have noticed, though, I have already read some content, because it is the same of chapter 5 in "A Practical Guide to Brain-Computer Interfacing with BCI2000" by Gerwin Schalk and Jurgen Mellinger.

Regarding SVM, you guessed right: since I am just a student, I do not have to implement those by myself, so EEGLAB and BCILAB should be handy, later.

Regarding FFT, I think I have read somewhere in the book that BCI2000 should have a FFT filter; anyway for now this is not important.

I have just talked with my professor: for now I have to work on a simple application I prefer among the ones already implemented in BCI2000.

I would like to use the One Dimensional Cursor Control. (just like this: http_nospam_youtu.be/zozOjmpD5Cw)

My goal is to use the Emotiv headset to control the cursor: where should I look for a tutorial?

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Very simple valence & arousal identification

Post by boulay » 10 Dec 2013, 12:11

Sorry I made a mistake. I was assuming that you did have to implement it yourself because you were a student. But that assumption seems wrong. So instead of writing your own code to do the feature extraction and classification, you can simply use some tools (such as EEGLAB and BCILAB) to do it. There is also an Offline Analysis tool that comes with BCI2000 that you could try.

As for implementing the FFT in BCI2000, you are right that there is a FFT filter. It is rare that a signal processing module would need the FFT only, but it is commonly found in combination with other filter modules. For example, take a look at the SpectralSignalProcessing module. It does several things (spatial filter, frequency transform using either FFT or AR methods, linear classifier, expression filter, normalizer), all of which may be useful to you for online BCI operation.

acampione
Posts: 10
Joined: 15 Nov 2013, 07:42

Re: Very simple valence & arousal identification

Post by acampione » 12 Dec 2013, 09:43

Thanks again boulay.

And yes, when the time comes, I will sure have to combine more filter modules with the FFT.

However, at the moment, my teacher suggested to look for some already implemented application (with BCI2000) for emotions recognition (so precisely emotion based rather than motion based).

Any idea where I can find such an application? A very very simple one should be fine, the only condition is that it works based on emotion rather than motion (so a passive BCI)

I need it just for practicing with the basic BCI life cycle (raw data acquisition, filtering, classification...)

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Very simple valence & arousal identification

Post by boulay » 12 Dec 2013, 11:03

I think you're missing a basic principle of BCI.

It is not an emotion detector. It is not a thought detector. It is not a motion detector. All it can do is discriminate between two (or more) brain states, but only if those brain states have significantly different signal features and only if you train the BCI to recognize those signal features.

Follow through the mu-rhythm tutorial (AKA sensorimotor rhythm tutorial, AKA motor imagery tutorial). Please, just do it.

After you've gone through the tutorial, you will do the same thing but instead of instructing the subject to do right hand imagery and left hand imagery (or rest or foot imagery, etc), you will be instructing your subject to be anxious or to be relaxed. Then, after you get the anxious data and relaxed data, you will follow the same steps as in the tutorial to get your emotion classifier.

Instructing someone to be anxious might be difficult. Instead of giving them a simple verbal instruction, you may want to play a video clip or show a picture that helps evoke that emotion. The StimulusPresentation application module will probably be able to do this. (I've never used that module myself)

Some people (like Emotiv) may claim that you can get a universal emotion classifier that will work for every subject without training data. That might be true, but it probably won't work nearly as well as if you get a new classifier for every subject for every session. I also highly doubt that you are expected to use a universal classifier since you were instructed to use SVM, and SVM will typically have poor generalizability unless you have a huge amount of training data from many subjects.

acampione
Posts: 10
Joined: 15 Nov 2013, 07:42

Re: Very simple valence & arousal identification

Post by acampione » 12 Dec 2013, 12:20

Thanks, I am really grateful for your clarifications.

They are helping me a lot in understanding better this new world of BCI I am approaching for the very first time.

I really want to follow the the mu-rhythm tutorial, the only problem is that I do not own a device for acquiring raw data (brain signals).

I have been told that I can use data acquired in previous/different experimentations (even for the mu-rhythm tutorial) and that there should be data available for this purpose in the BCI folder or somewhere else.

I can't find those raw data which are essential to perform the very first step of the mu-rhythm tutorial (Obtaining_Mu_Rhythm_Parameters_in_an_Initial_Session) and then proceeding with the following steps.

Summarizing (hope my english was good) the question is: since I do not have a device for acquiring raw data (for example, the first step of the mu-rhythm tutorial mentions an amplifier from the gMOBIlab family), where can I find these kind of data I need to proceed with the mu-rhythm tutorial?

Again, boulay, thanks for your patience.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Very simple valence & arousal identification

Post by boulay » 12 Dec 2013, 12:55

You can try the BCI competition data sets. This one is appropriate:
http://www.bbci.de/competition/ii/#download

I think BCI2000 comes with sample data, but I can't check now, sorry.

acampione
Posts: 10
Joined: 15 Nov 2013, 07:42

Re: Very simple valence & arousal identification

Post by acampione » 17 Dec 2013, 07:14

Hi Boulay,

I am in this section of the tutorial: User Tutorial:Analyzing the Initial Mu Rhythm Session

It says to "Start the BCI2000 Offline Analysis tool"

I did not have a version of Matlab installed, so I followed the instructions provided here: http://www.bci2000.org/wiki/index.php/U ... ATLAB_v7.0.

I did exactly what the page said:

1) I downloaded the MCR installer for Windows
2) I installed it following on screen instructions

Then I navigated to tools/OfflineAnalysis/ and double-clicked OfflineAnalysisWin.exe to begin analyzing the data.

It showed up a cmd window for a fraction of second which immediately closes up.

So I tried running OfflineAnalysisWin.exe from cmd as Administrator for viewing what the problem was.

This is the error.

Code: Select all

D:\Programmi\BCI2000\tools\OfflineAnalysis>OfflineAnalysisWin.exe
??? Error using ==> OfflineAnalysis>reloadSettings at 1431
Some of the files necessary are missing or have been corrupted.  Please reinstal
l.


Warning: 1 invisible figure(s) exist at MCR termination.

If your application has terminated unexpectedly, please note that
 applications generated by the MATLAB Compiler terminate when there are no
 visible figure windows. See the documentation for WaitForFiguresToDie and
 WAITFORCALLBACKS for more information.

Warning: Class
    'uitools.uibuttongroup'
in use at MCR termination.

If your application has terminated unexpectedly, please note that
 applications generated by the MATLAB Compiler terminate when there are no
 visible figure windows. See the documentation for WaitForFiguresToDie and
 WAITFORCALLBACKS for more information.

Warning: Class
    'uitools.uimodemanager'
in use at MCR termination.

If your application has terminated unexpectedly, please note that
 applications generated by the MATLAB Compiler terminate when there are no
 visible figure windows. See the documentation for WaitForFiguresToDie and
 WAITFORCALLBACKS for more information.

Warning: Class
    'uitools.uimode'
in use at MCR termination.

If your application has terminated unexpectedly, please note that
 applications generated by the MATLAB Compiler terminate when there are no
 visible figure windows. See the documentation for WaitForFiguresToDie and
 WAITFORCALLBACKS for more information.

Warning: Class
    'graphics.datacursormanager'
in use at MCR termination.

If your application has terminated unexpectedly, please note that
 applications generated by the MATLAB Compiler terminate when there are no
 visible figure windows. See the documentation for WaitForFiguresToDie and
 WAITFORCALLBACKS for more information.


D:\Programmi\BCI2000\tools\OfflineAnalysis>
If I try to run instead OfflineAnalysis.bat from cmd, I have this other error (the same happens if I double click the file)

Code: Select all

D:\Programmi\BCI2000\tools\OfflineAnalysis>OfflineAnalysis.bat

D:\Programmi\BCI2000\tools\OfflineAnalysis>matlab -nosplash -r "addpath(cd); Off
lineAnalysis"
"matlab" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

D:\Programmi\BCI2000\tools\OfflineAnalysis>
How can I solve this? I cannot proceed with the tutorial!

Locked

Who is online

Users browsing this forum: Google [Bot] and 2 guests