Page 1 of 1

Common Spatial Patterns (CSP) Algorithm

Posted: 10 Feb 2009, 12:41
by jeethridge
Hello all. I am currently attempting to implement the CSP algorithm in MATLAB. From what I understand, there are two validation checks one can perform on the algorithm. One is that the eigenvalues for each class of whitened data sum to 1 (I). The other is that the eigenvectors of the whitened class data are identical. In our implementation of the algorithm only the first test seems to hold. Does anyone know of anywhere I can find source code for a known working CSP implementation to compare to my own. I can post my matlab code if necessary also.

Cheers.

Posted: 12 Feb 2010, 22:36
by dsteines
The BioSig toolbox has an implementation of the CSP algorithm:

http://biosig.sourceforge.net/help/biosig/t300/csp.html

You will need to download the toolbox to get the file. It lets you choose between solving the generalized eigenvalue problem or the common diagonalization method. I have not tested their code, but you might find it useful for comparison.

I'll guess that you've probably read it, but "Optimizing spatial filters for robust EEG single-trial analysis" by Blankertz, et al. provides a thorough introduction to the CSP algorithm. The eigenvalues of each class in corresponding surrogate channels should sum to one. I am not sure about your second test though.

Good luck!

David

Re: Common Spatial Patterns (CSP) Algorithm

Posted: 10 Apr 2014, 13:20
by Sri_usw
Hello,
I downloaded the dataset(Dataset1) from BCI competition IV and trying to apply Common Spatial Pattern(CSP). I separated the two data set into two classes ( class1=79604*59 and class2=86709*59). I passed them through CSP.m(sum of eigen values of two classes=1,I sure that there is no mistake in my csp.m file) file and got the output as 59*59 matrix(spatial filter coefficients).
I took first column representing as class1 and last column representing as class2 and then classified them but shockingly i got only 59% classification.
I Can’t figure out what mistake I have made. Could you help me out please .thanks in advance
Regards,