[FieldTrip] Error occurs when applying searchgrid for lambda in MVPA light toolbox

Herfurth, Kirsten Kirsten.Herfurth at uk-erlangen.de
Mon May 13 12:30:57 CEST 2019


Hi Sophie,

many thanks!!

Best,

Kirsten

Von: Arana, S.L. (Sophie) [mailto:S.Arana at donders.ru.nl]
Gesendet: Montag, 13. Mai 2019 12:17
An: Herfurth, Kirsten; fieldtrip at science.ru.nl
Betreff: Re: Error occurs when applying searchgrid for lambda in MVPA light toolbox


Hi Kirsten,



thank you for the code, I can now replicate the error. The reason I could not replicate it earlier was because I had not pulled the latest changes in the MVPA toolbox. Now I get the same error and to me this looks like a bug in the code caused by the latest change. The weights are not properly split into train and test set when doing the nested cross-validation for selecting lambda.



I am not sure where in the code to best fix this, so I created an issue over on Matthias's github. He's usually very fast in fixing things :)

If you have a github account you could watch his repo to be notified about conversations on this issue https://github.com/treder/MVPA-Light.



Best,

Sophie

________________________________
From: Herfurth, Kirsten <Kirsten.Herfurth at uk-erlangen.de>
Sent: Friday, May 10, 2019 2:27 PM
To: Arana, S.L. (Sophie); fieldtrip at science.ru.nl
Subject: AW: Error occurs when applying searchgrid for lambda in MVPA light toolbox

Dear Sophie,

thanks a lot for your quick answer. The configuration I used is the following:

cfg = [] ;
cfg.method          = 'mvpa';
cfg.mvpa.classifier = 'logreg';
cfg.mvpa.metric     = 'accuracy';
cfg.mvpa.k          = 3;
cfg.mvpa.param.reg = 'l2';
cfg.mvpa.param.lambda = 'auto';
cfg.mvpa.param.plot = 1;
cfg.latency         = [0.5, 0.7];
cfg.avgovertime     = 'yes';
cfg.design          = [ones(nFIC,1); 2*ones(nFC,1);];
stat = ft_timelockstatistics(cfg, dataFIC_LP, dataFC_LP)

It seems to be important to write cfg.mvpa.param instead of cfg.param, otherwise it just ignores the L2 regularization and runs  ‘logf’ instead.

I hope you can replicate the error this way.

Thanks in advance, best,

Kirsten




Von: Arana, S.L. (Sophie) [mailto:S.Arana at donders.ru.nl]
Gesendet: Donnerstag, 9. Mai 2019 11:18
An: fieldtrip at science.ru.nl
Cc: Herfurth, Kirsten
Betreff: Re: Error occurs when applying searchgrid for lambda in MVPA light toolbox


Dear Kirsten,



I could not replicate your error with the MVPAlight toolbox. Could you post the code you used on the tutorial data that gave you the error?



Best,

Sophie​

________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Herfurth, Kirsten <Kirsten.Herfurth at uk-erlangen.de>
Sent: Tuesday, May 7, 2019 1:08 PM
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] Error occurs when applying searchgrid for lambda in MVPA light toolbox

Dear fieldtrip developers,

I’m extremely enthusiastic about the newly implemented MVPA light toolbox on fieldtrip, thanks a lot! I’m trying out logistic regression on my data and would like to do a search grid for lambda with cfg.mvpa.param.lambda = ‘auto’. However, I get the following error message in line 433 of train_logreg.m when calculating the gradient g = ((cfg.weights .* sigma)' * YX)'/N - sumyxN + lambda * w: matrix dimensions must agree.
If I just pass one value for lambda, it works fine.
The same error occurs with the tutorial data. Here, cfg.weights has a 100x1 dimension, and sigma is 80x1 in size. I’m using Matlab 2017b and the most recent fieldtrip 2019-04-19 version.

I don’t know where to fix this and would be very grateful for your help.

Best wishes,

Kirsten Herfurth

Post-Doc at the MEG-lab in Erlangen, Germany




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190513/5577109d/attachment-0002.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list