<p><span style="padding: 3px 10px; border-radius: 5px; color: #ffffff; font-weight: bold; display: inline-block; background-color: #ff0000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p></p><div dir="ltr">Dear Mikkel,<div><br></div><div>As detailed in the documentation, the weights are stored in the `filters_` attribute.</div><div><br></div><div><div>Attributes</div><div>    ----------</div><div>    ``filters_`` : ndarray, shape (n_components, n_channels)</div><div>        If fit, the SPoC spatial filters, else None.</div></div><div><br></div><div>In your example, you&#39;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&#39;t store or return anything but the predictions. </div><div><br></div><div>To get the weights outside the cross validation, you can simply do</div><div>SPoC().fit(X, y).filters_  # shape(<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">n_components, </span>n_channels)</div><div><br></div><div>Else, you&#39;ll need to build the cross validation loop manually: e.g.</div><div>clf = SPoC()</div><div>filters = list()</div><div>for train, test in cv.split(X, y):</div><div>   clf.fit(X[train], y[train])</div><div>   clf.predict(X[test])</div><div>   filters.append(clf.filters_)</div><div><br></div><div>Finally, you can use SPoC to directly transform your data into the power per filter using the SPoC(transform_into=&#39;average_power&#39;)</div><div><br></div><div>Hope that helps,</div><div><br></div><div>Jean-Rémi</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 19 April 2018 at 18:34, Mikkel Vinding <span dir="ltr">&lt;<a href="mailto:mikkel.vinding@ki.se" target="_blank">mikkel.vinding@ki.se</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">        External Email - Use Caution        <br>
<br>
Hi Alex<br>
<br>
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:<br>
<br>
            # Make pipeline<br>
            clf = make_pipeline(SPoC(n_<wbr>components=2, log=True, reg=&#39;oas&#39;), Ridge())<br>
            # Define a two fold cross-validation<br>
            cv = KFold(n_splits=2, shuffle=False)<br>
            # Run cross validaton<br>
            y_preds = cross_val_predict(clf, X, y, cv=cv)<br>
<br>
Where or how do I find the pattern of the decoder?<br>
<span class=""><br>
Best regards<br>
Mikkel<br>
<br>
Mikkel C. Vinding | Ph.D. | Post doc<br>
NatMEG - The National Research Facility for Magnetoencephalography <br>
Department of Clinical Neuroscience | Karolinska Institutet<br>
171 77 Stockholm | Nobels väg 9, office D313<br>
Phone: +46 8 524 833 33 <br>
Email: <a href="mailto:mikkel.vinding@ki.se">mikkel.vinding@ki.se</a> | <a href="http://ki.se" rel="noreferrer" target="_blank">ki.se</a><br>
______________________________<wbr>________<br>
Karolinska Institutet – a medical university<br>
<br>
</span>-----Ursprungligt meddelande-----<br>
Från: <a href="mailto:mne_analysis-bounces@nmr.mgh.harvard.edu">mne_analysis-bounces@nmr.mgh.<wbr>harvard.edu</a> [mailto:<a href="mailto:mne_analysis-bounces@nmr.mgh.harvard.edu">mne_analysis-bounces@<wbr>nmr.mgh.harvard.edu</a>] För Alexandre Gramfort<br>
Skickat: den 14 april 2018 17:32<br>
Till: Discussion and support forum for the users of MNE Software &lt;<a href="mailto:mne_analysis@nmr.mgh.harvard.edu">mne_analysis@nmr.mgh.harvard.<wbr>edu</a>&gt;<br>
Ämne: Re: [Mne_analysis] DICS with external channel<br>
<div class="HOEnZb"><div class="h5"><br>
hi,<br>
<br>
you may want to give a try to :<br>
<br>
<a href="https://martinos.org/mne/stable/auto_examples/decoding/plot_decoding_spoc_CMC.html" rel="noreferrer" target="_blank">https://martinos.org/mne/<wbr>stable/auto_examples/decoding/<wbr>plot_decoding_spoc_CMC.html</a><br>
<br>
then I would source localize with a dipole fit the pattern of the decoder.<br>
<br>
Alex<br>
<br>
<br>
<br>
<br>
On Fri, Apr 13, 2018 at 6:10 PM, Mikkel Vinding &lt;<a href="mailto:mikkel.vinding@ki.se">mikkel.vinding@ki.se</a>&gt; wrote:<br>
&gt; Hello<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Do anybody out there have experience with using the DICS beamformer in <br>
&gt; MNE to find sources coherent with an external signals? E.g. using EMG <br>
&gt; to finding cortico-muscular coherence as done in the original DICS <br>
&gt; paper by Gross et al. 2001.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; So far it seems that the DICS beamformer in MNE only take the <br>
&gt; cross-spectra from MEG sensors, but not able to specify CSD with a <br>
&gt; non-MEG channel. It seems that in order to calculate the CSD between <br>
&gt; MEG sensors and external reference I first have to label the external <br>
&gt; channels as an MEG channel, as mne-time_frequency.csd/csd_<wbr>epochs will <br>
&gt; only calculate the CSD matrix between MEG channels. This does however <br>
&gt; not solve my next problem: that I only need the external reference-MEG <br>
&gt; CSD for the source localization. Anybody who have a workaround or solution?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Best regards<br>
&gt;<br>
&gt; Mikkel<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Mikkel C. Vinding | Ph.D. | Post doc<br>
&gt; NatMEG - The National Research Facility for Magnetoencephalography <br>
&gt; Department of Clinical Neuroscience | Karolinska Institutet<br>
&gt; 171 77 Stockholm | Nobels väg 9, office D313<br>
&gt; Phone: +46 8 524 833 33<br>
&gt; Email: <a href="mailto:mikkel.vinding@ki.se">mikkel.vinding@ki.se</a> | <a href="http://ki.se" rel="noreferrer" target="_blank">ki.se</a><br>
&gt; ______________________________<wbr>________<br>
&gt; Karolinska Institutet – a medical university<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; ______________________________<wbr>_________________<br>
&gt; Mne_analysis mailing list<br>
&gt; <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.<wbr>edu</a><br>
&gt; <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.<wbr>edu/mailman/listinfo/mne_<wbr>analysis</a><br>
&gt;<br>
&gt;<br>
&gt; The information in this e-mail is intended only for the person to whom <br>
&gt; it is addressed. If you believe this e-mail was sent to you in error <br>
&gt; and the e-mail contains patient information, please contact the <br>
&gt; Partners Compliance HelpLine at <a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/<wbr>complianceline</a> <br>
&gt; . If the e-mail was sent to you in error but does not contain patient <br>
&gt; information, please contact the sender and properly dispose of the <br>
&gt; e-mail.<br>
&gt;<br>
<br>
______________________________<wbr>_________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.<wbr>edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.<wbr>edu/mailman/listinfo/mne_<wbr>analysis</a><br>
<br>
______________________________<wbr>_________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.<wbr>edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.<wbr>edu/mailman/listinfo/mne_<wbr>analysis</a></div></div></blockquote></div><br></div>