Transfer classification with time-frequency data without features
Closed this issue · 1 comments
Hi Matthias,
when I try to do cross decoding for time-frequency data (4D, samples x channels x frequencies x timepoints) with one dataset for training and one dataset for testing and specifying no feature dimension, I get the following error:
Error using reshape
Size vector must have at least two elements.
Error in squeeze1 (line 19)
X = reshape(X, sz);
Error in mv_classify (line 483)
Xtest_ix = squeeze1(Xtest(sample_skip{:}, ix_test{:}, feature_skip{:}));
This is the code I used:
cfg = [];
cfg.classifier = 'lda';
cfg.metric = {'auc', 'accuracy'};
cfg.sample_dimension = 1;
cfg.feature_dimension = [];
cfg.dimension_names = {'samples', 'channels', 'frequencies', 'timepoints'};
cfg.preprocess = 'undersample';
[perf_cross, cross_result] = mv_classify(cfg, data1, clabels1, data2, clabels2);
The same code works with an older version of the MVPAlight toolbox that I downloaded on 25.03.2022.
Including these lines of codes in the squeeze1 function lets me run the analysis for now, but I am not sure if everything else then still works as intended:
if length(sz) == 1
sz = [sz 1];
end
Do you have any suggestions on how to fix it?
Thank you!
Maren
Hi @marenwolf
Apologies I didn't get to it earlier on - it's indeed a bug and your code fixes it, thank you !
I did some more testing and there's no unwanted side effects from what I see so I've committed the change.