Feature extraction in MI-CSP

Working with OpenViBE signal processing scenarios and doing scenario/BCI design
Post Reply
mhadji05
Posts: 53
Joined: Tue Mar 16, 2021 9:37 am

Feature extraction in MI-CSP

Post by mhadji05 »

Hello

I have some questions about scenarios mi-csp-2-train-CSP.xml & mi-csp-3-classifier-trainer.xml
After running them I received the following messages (see image).

1) Data covariance dims are [19x19]. What does this mean and why is it [19x19]?
2) cond1 = 20 chunks, sized 500 ->10000 samples.
cond2 = 20 chunks, sized 500 ->10000 samples. Ηere I guess it's 20 chunks because it's 20 trials per class, right? Also sized 500 ->10000 samples. What does this mean and why is it sized 500 ->10000 samples. Means 500 bytes for 10000 samples? Why is 10000 samples?

3) Received train stimulation. Data dim is [2160x6]. What does this mean and why is it [2160x6]?
4) 1080 feature vectors for input 1.
1080 feature vectors for input 2. Why 1080 feature vectors? What is into the feature vectors ? How many features are extracted for each trial?

Image

Thibaut
Posts: 264
Joined: Wed Oct 31, 2018 9:14 am

Re: Feature extraction in MI-CSP

Post by Thibaut »

Hi,
1)19x19 is bevause you have 19 features (channels)
2) 20 Chunks is because 20 trials with a size of 500 so you have 10000 sample (500*20)
3) You have 2160 features vector (1080 and 1080) with 6 features. (the CSP have reduce the feature number from your signal in fact 19 to 6)
4) Because it's the number of feature vector.^^
Thibaut

mhadji05
Posts: 53
Joined: Tue Mar 16, 2021 9:37 am

Re: Feature extraction in MI-CSP

Post by mhadji05 »

Dear @Thibaut thanks for your response.

Why every trial size is 500? And what type of measurement is it? 500 bytes?
I still do not understand why 1080 feature vectors. Can I change the number of feature vectors? How? and Why is a bad or good idea?

Thanks.

Thibaut
Posts: 264
Joined: Wed Oct 31, 2018 9:14 am

Re: Feature extraction in MI-CSP

Post by Thibaut »

HI,
1) 500 Samples (Depends of your epoch size).
2) It's the base of classification, The dataset change all. Too much, not enough, bad input.....
Thibaut

Thomas
Posts: 210
Joined: Wed Mar 04, 2020 3:38 pm

Re: Feature extraction in MI-CSP

Post by Thomas »

Hi,

To fill in what Thibaut said, basically, the numbers you see depend on the number of channels, the sampling frequency at which data is acquired, and also the epoching boxes (time based and stimulation based).

So the first thing to understand the values you're seeing: What is your acquisition sampling frequency ?
And then, did you change any of the epoching boxes settings (in the CSP trainer scenario and the classifier trainer scenario) ? If yes, could you detail those changes ?

Thanks,
Thomas

mhadji05
Posts: 53
Joined: Tue Mar 16, 2021 9:37 am

Re: Feature extraction in MI-CSP

Post by mhadji05 »

Hello Thomas thanks for your response. I appreciate a lot your help.

OpenBCI device
Sampling rate = 125 Hz
Sample count per sent block = 32

I didn't change any settings on the boxes.

Stimulation based epoching
epoch duration = 4sec
epoch offset = 0.5 sec

Time based epoching
epoch 1 duration = 1 sec
epoch 1 intervals = 0.0625 sec

Thomas
Posts: 210
Joined: Wed Mar 04, 2020 3:38 pm

Re: Feature extraction in MI-CSP

Post by Thomas »

Thanks for the details.

The value 500 is an amount of samples per chunk.
The stimulation based epoching generates a 4 seconds epoch. So for that chunk of 4 seconds: 4 * 125 = 500 samples.

Now the 1080 (per condition) or 2160 altogether comes from the combination of the Stim based epoching followed by the time based epoching.
The Stim based epoching outputs chunks of 4 seconds (20 for each side), and each of them goes through the time based epoching.
Each chunk is therefore re-epoched (with overlap since the interval between epochs is 0.0625 second), generating a total of 1080 epochs that are processed and aggregated.

Hope this helps clarifying where the values come from.

Cheers,
Thomas

mhadji05
Posts: 53
Joined: Tue Mar 16, 2021 9:37 am

Re: Feature extraction in MI-CSP

Post by mhadji05 »

Thank you very much Thomas for your explanation.
I fully understand the 1st part.

Unfortunately, I don't fully understand where 1080 examples comes from.
According to what you have said:
Now the 1080 (per condition) or 2160 altogether comes from the combination of the Stim based epoching followed by the time based epoching.
The Stim based epoching outputs chunks of 4 seconds (20 for each side), and each of them goes through the time based epoching.
Each chunk is therefore re-epoched (with overlap since the interval between epochs is 0.0625 second), generating a total of 1080 epochs that are processed and aggregated.
If I calculate 4 / 0.0625 = 64 epochs per trial. 64 epochs * 20 trials = 1280 and not 1080.
What am I calculating wrong?

Finally how many features are extracted for each trial?

Thomas
Posts: 210
Joined: Wed Mar 04, 2020 3:38 pm

Re: Feature extraction in MI-CSP

Post by Thomas »

Hi,

Sorry I didn't go into details, and actually had not done it for your example.

For a chunk of 4 seconds, the time based epoching will generate 49 epochs of 1 second, not 64 as the last epoch is starting at 3.0s and finishing at 4.0s.
The calculation is more like : 3 / 0.0625 = 48 + 1(the epoch between the 3rd and 4th seconds) = 49.
To answer your last question, this is the number of features extracted for each trial.

Then, as you did, multiplied by the number of trial should give you the number of features generated. However I realise that 49 * 20 is only 980, and not the 1080 you are displaying. These calculation are as expected in the exemple scenario and data provided with OpenViBE. I am not sure what makes it different with your scenario/data. Are you reusing the same data for the CSP trainer and the Classifier trainer ?

Thanks,
Thomas

mhadji05
Posts: 53
Joined: Tue Mar 16, 2021 9:37 am

Re: Feature extraction in MI-CSP

Post by mhadji05 »

Hi Thomas,

Yes, I use the same data for the CSP trainer and the Classifier trainer.
Unfortunately, I can not understand why this happens.

mhadji05
Posts: 53
Joined: Tue Mar 16, 2021 9:37 am

Re: Feature extraction in MI-CSP

Post by mhadji05 »

Following on from the previous discussion, Thibaut stated the following:
"3) You have 2160 features vector (1080 and 1080) with 6 features. (the CSP have reduced the feature number from your signal in fact 19 to 6)"

a) Why did CSP reduce the features from 19 to 6 and not more or less than 6?
b) What are these 6 features?
c) Are these features related at all to the ERD/ERS mentioned by Pfurtscheller?

Pfurtscheller, G., and Aranibar, A. (1979). Evaluation of event-related desynchronization (ERD) preceding and following voluntary self-paced movement. Electroencephalogr. Clin. Neurophysiol. 46, 138–146.
doi: 10.1016/0013-4694(79)90063-4

https://www.sciencedirect.com/science/a ... via%3Dihub

Thomas
Posts: 210
Joined: Wed Mar 04, 2020 3:38 pm

Re: Feature extraction in MI-CSP

Post by Thomas »

Hi mhadji05,

Each channel is a feature, but the CSP Spatial Filter performs filtering and reduces this amount of channels and therefore the amount of features.

The CSP Spatial Filter Trainer box has its parameter "filter dimension" set to 6. Its model is saved in the configuration file (also specified as a parameter of the box) that is then used by the CSP Spatial Filter box in the next scenario.
It is this value of 6 that sets the amount of output channels from the CSP Spatial Filter box.

And for your last point, I don't think this is quite the same no, since the features from the CSP Spatial Filter are modelled by the box from channels, and do not correspond to ERD/ERS.

Hope this helps a little.

Cheers,
Thomas

Post Reply