[Mne_analysis] Question about spatial patterns using LinearModel() and cross-validation

JR KING jeanremi.king at gmail.com
Wed Jan 24 15:31:50 EST 2018
Search archives:

Hi Ana,

Indeed, in theory it's probably best to report the patterns that match the
decoding scores, and thus use cross-validation:

e.g.

X=epochs.get_data()
y=epochs.events[:, 2]


pipeline = make_pipeline(StandardScaler(), LogisticRegression())
patterns = list()
for train, test in cv.split(X, y):
     lm = LinearModel(pipeline)
     lm.fit(X, y)
     pattern = get_coef(lm, 'patterns_')
     patterns.append(pattern)
patterns= np.mean(patterns, axis=0)

However, in practice this CV is an overkill because the patterns (and
spatial filters) correspond to the model, and thus depend on the training
data. Since the training splits are not independent with one another, the
patterns across splits should be very similar - and in fact converge
towards the patterns of the non-cv fit.

Hope that helps

Jean-Remi



On 24 January 2018 at 11:15, Ana Vedoveli <ana.vedoveli at gmail.com> wrote:

> Dear all,
>
> I am dealing with a classification problem (Linear SVMs) in EEG data. I am
> a new-comer in Python and also in the MNE community, so what I am going to
> ask might sound silly.
>
> I am trying to estimate the patterns using the LinearModel and get_coef().
> I was looking in the documentation (http://martinos.org/mne/
> stable/auto_examples/decoding/plot_linear_model_patterns.html), and saw
> that the LinearModel() class is not cross-validated. I was wondering it
> would make sense to retrieve cross-validated spatial patterns?
>
> Thank you for your attention.
>
> Best wishes,
> Ana Vedoveli
>
> _______________________________________________
> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180124/51fc22f4/attachment.html 


More information about the Mne_analysis mailing list