[Mne_analysis] How do you read CSP in case of many classes

Michael Martinez michaelmart1977 at gmail.com
Thu Mar 7 06:18:45 EST 2019
Search archives:

        External Email - Use Caution        

Hi all,
Thanks for the acceptance!
I have 15 classes and using common spatial patterns.
I'm plotting the first common spatial pattern as attached. In case of two
classes (for example: hand movement, rest) then the spatial pattern shows
two colors red, and blue. For example red is for movement and blue is for
I understand that the common spatial pattern is one vs. all . But when I
plot in case of many classes, then which class vs. all is shown in the
topoplot here?
Can I specify which class vs. all to plot?
Below is part of the code I'musing :

csp = CSP(n_components=20,reg=None)

## compute spatial filtered spectrum
_po = []
for x in my_array:
    f,p = welch(np.dot(csp.filters_[0,:].T,x), 500, nperseg=50)
po = np.array(po)

## prepare topoplot
_,epos,_,_,_ = _prepare_topo_plot(my_raw,'eeg',None)

## plot first pattern
pattern = csp.patterns_[0,:]
pattern -= pattern.mean()
ix = np.argmax(abs(pattern))
if pattern[ix]>0:
        sign = 1.0
        sign = -1.0
fig, ax_topo = plt.subplots(1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190307/e7b3dd63/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: first_pattern.jpg
Type: image/jpeg
Size: 22110 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190307/e7b3dd63/attachment-0001.jpg 

More information about the Mne_analysis mailing list