[Mne_analysis] DICS with external channel

JR KING jeanremi.king at gmail.com
Sat Apr 21 09:51:38 EDT 2018
Search archives:

        External Email - Use Caution        

Dear Mikkel,

As detailed in the documentation, the weights are stored in the `filters_`
attribute.

Attributes
    ----------
    ``filters_`` : ndarray, shape (n_components, n_channels)
        If fit, the SPoC spatial filters, else None.

In your example, you're using `cross_val_predict`, a shortcurt function
from sklearn that pipes the classifier and the EEG data in a cross
validation loop. Each split sends different SPoC objects and different
training sets. This function doesn't store or return anything but the
predictions.

To get the weights outside the cross validation, you can simply do
SPoC().fit(X, y).filters_  # shape(n_components, n_channels)

Else, you'll need to build the cross validation loop manually: e.g.
clf = SPoC()
filters = list()
for train, test in cv.split(X, y):
   clf.fit(X[train], y[train])
   clf.predict(X[test])
   filters.append(clf.filters_)

Finally, you can use SPoC to directly transform your data into the power
per filter using the SPoC(transform_into='average_power')

Hope that helps,

Jean-Rémi

On 19 April 2018 at 18:34, Mikkel Vinding <mikkel.vinding at ki.se> wrote:

>         External Email - Use Caution
>
> Hi Alex
>
> Thank you for the answer. When I run the SPoC decoder the output is the
> predicted value for the reference signal. I cannot find the weights of the
> classifier on the sensors in any of the variables it creates:
>
>             # Make pipeline
>             clf = make_pipeline(SPoC(n_components=2, log=True,
> reg='oas'), Ridge())
>             # Define a two fold cross-validation
>             cv = KFold(n_splits=2, shuffle=False)
>             # Run cross validaton
>             y_preds = cross_val_predict(clf, X, y, cv=cv)
>
> Where or how do I find the pattern of the decoder?
>
> Best regards
> Mikkel
>
> Mikkel C. Vinding | Ph.D. | Post doc
> NatMEG - The National Research Facility for Magnetoencephalography
> Department of Clinical Neuroscience | Karolinska Institutet
> 171 77 Stockholm | Nobels väg 9, office D313
> Phone: +46 8 524 833 33
> Email: mikkel.vinding at ki.se | ki.se
> ______________________________________
> Karolinska Institutet – a medical university
>
> -----Ursprungligt meddelande-----
> Från: mne_analysis-bounces at nmr.mgh.harvard.edu [mailto:
> mne_analysis-bounces at nmr.mgh.harvard.edu] För Alexandre Gramfort
> Skickat: den 14 april 2018 17:32
> Till: Discussion and support forum for the users of MNE Software <
> mne_analysis at nmr.mgh.harvard.edu>
> Ämne: Re: [Mne_analysis] DICS with external channel
>
> hi,
>
> you may want to give a try to :
>
> https://martinos.org/mne/stable/auto_examples/decoding/
> plot_decoding_spoc_CMC.html
>
> then I would source localize with a dipole fit the pattern of the decoder.
>
> Alex
>
>
>
>
> On Fri, Apr 13, 2018 at 6:10 PM, Mikkel Vinding <mikkel.vinding at ki.se>
> wrote:
> > Hello
> >
> >
> >
> > Do anybody out there have experience with using the DICS beamformer in
> > MNE to find sources coherent with an external signals? E.g. using EMG
> > to finding cortico-muscular coherence as done in the original DICS
> > paper by Gross et al. 2001.
> >
> >
> >
> > So far it seems that the DICS beamformer in MNE only take the
> > cross-spectra from MEG sensors, but not able to specify CSD with a
> > non-MEG channel. It seems that in order to calculate the CSD between
> > MEG sensors and external reference I first have to label the external
> > channels as an MEG channel, as mne-time_frequency.csd/csd_epochs will
> > only calculate the CSD matrix between MEG channels. This does however
> > not solve my next problem: that I only need the external reference-MEG
> > CSD for the source localization. Anybody who have a workaround or
> solution?
> >
> >
> >
> > Best regards
> >
> > Mikkel
> >
> >
> >
> > Mikkel C. Vinding | Ph.D. | Post doc
> > NatMEG - The National Research Facility for Magnetoencephalography
> > Department of Clinical Neuroscience | Karolinska Institutet
> > 171 77 Stockholm | Nobels väg 9, office D313
> > Phone: +46 8 524 833 33
> > Email: mikkel.vinding at ki.se | ki.se
> > ______________________________________
> > Karolinska Institutet – a medical university
> >
> >
> >
> >
> > _______________________________________________
> > Mne_analysis mailing list
> > Mne_analysis at nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> >
> >
> > The information in this e-mail is intended only for the person to whom
> > it is addressed. If you believe this e-mail was sent to you in error
> > and the e-mail contains patient information, please contact the
> > Partners Compliance HelpLine at http://www.partners.org/complianceline
> > . If the e-mail was sent to you in error but does not contain patient
> > information, please contact the sender and properly dispose of the
> > e-mail.
> >
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180421/95af3ecf/attachment.html 


More information about the Mne_analysis mailing list