rubmoe wrote:in the end determine the accuracy of the bci2000.
rubmoe wrote:So for each sample [...] I would like to see if the BCI would classify it correctly or not.
These are two different things, but I think the confusion just stems from unfamiliarity with the terminology.
A 'sample' is the data from all your channels at a single time-point. Maybe you are collecting 256 samples per second.
A 'block' is a set of adjacent samples (maybe 32 samples) that are transmitted in aggregate from the hardware to the software. fs=256; blocksize=32; blockrate=256/32=8;
A 'trial' is a repeated experimental manipulation. In your case this is a 4 second period. You have two trial types or trial conditions. Do you have a rest period in between left MI and right MI periods? If so, the rest period is usually included in the definition of a 'trial' at the beginning, as sometimes the data from the resting period is used to normalize the following MI data.
Using the terminology above, my understanding is that you are most interested in classifying trials as left or right, then you will compare this classification result with the true trial condition to determine your accuracy. Is that correct?
Forgetting BCI2000 for a second, the most basic way you could do this is to calculate the FFT of the 4 seconds of data from each trial for a single channel (say C3), extract the amplitude at ~10Hz (aka mu rhythm), then regress C3 mu amplitude against true trial class (left=-1; right=+1). Using the coefficients determined by the regression, you can then calculate an expected class value for each trial and classify anything <0 as 'left' and anything >=0 as 'right'. Actually, you'd probably want to do a leave-one-out cross-validation, but let's keep this simple for now.
Instead of doing a single FFT from the 4 seconds, you can do 25 FFTs using 1-second windows with 87.5% overlap. You can use all 25 mu-rhythm amplitude values in a multivariate regression or you could simply average those values for each trial and use the per-trial sum in a univariate regression as above.
What happens online is closer to the following: treat each of the 25 values (* previous ~3 trials = 75 values) as independent measures and include them all in the univariate regression. Use the coefficients from the univariate regression to calculate a class-value for each new window of data. Sum all class-values within a trial. The sign of the summed class values is your trial class.
I'll leave it to you to determine how each Filter works, but the outputs are as follows:
TransmissionFilter: selected channel(s) data; 1 block (n_transmitted_channels x samples_per_block)
SpatialFilter: Re-referenced channel(s) data block. e.g., CAR, Laplacian, ICA (n_reref_chans x samples_per_block)
SpectralEstimation: Amplitude (or power) at each frequency for each channel calculated from the last WindowLength-s of data. (n_reref_chans x n_freqs)
LinearClassifier: N linear combination(s) of channel*frequency values, where N is the number of dimensions your BCI will use (typically 1). e.g., average of power from 8-12 Hz at C3 - average of power from 8-12 Hz at C4 = 1 output per block.
LPFilter: a smoothed version of the above.
ExpressionFilter: Can be anything. I like to take -10*log10(power) to convert my power (uV^2) to dB and have activation (usually a decrease in mu) be up.
Normalizer: A z-scored (sorta) version of the above, where the data used to calculate the mean and variance are the last BufferLength-s of values. You would describe two buffers, one for left MI trials and one for right MI trials, and these buffers are then combined when calculating the mean and variance. Each new value has this mean (NormalizerOffsets) subtracted and is scaled down by the variance (NormalizerGains).
Thus the output of the Normalizer has a mean of 0 and a variance of 1. Since each trial class is equally represented in the buffers, the mean of the buffers is assumed to represent something like a midpoint between the data from each class and thus the Normalizer output is >=0 for one class and <0 for another class. You simply sum the outputs of the Normalizer for a given trial and the sign of the result is that trial's class.
*Slight edits for clarity.