treder/MVPA-Light

mv_classify_timextime_two_datasets not found and lda_classifier error

Closed this issue · 3 comments

Hi Matthias,

I would like also to use the function mv_classify_timextime_two_datasets as you mention in the documentation that should be appropriate for my case but I could not find this function anywhere.

So I have tried to use lda_classifier with two datasets:
train_dataset = trials_train x channels matrix
test_dataset = trials_test x channels matrix
The number of trials of the two matrices is different.
I use the function in this way:
[label, dval, post] = lda_classifier(train_dataset, labels, test_dataset, 'auto').

I am performing also a cross validation and everything is done per each data point of the training and of the testing dataset.

I get this error:

In train_lda (line 56)
In lda_classifier (line 39)
Warning: Rank deficient, rank = 0, tol = 0.000000e+00.
Error using NaN
Input following 'like' is not a single or double array.

Error in cov (line 136)
c = NaN(n,'like', x);

Error in train_lda (line 56)
mu2= mean(X(idx2,:))';

Error in lda_classifier (line 39)
cf = train_lda(struct('gamma',gamma),Xtrain,labels);

Do you have any suggestions on how to fix it?

Thanks in advance for your help,

Federica

Hi Matthias,
thank you very much for you help!

I have followed your suggestion and did the training-test by hand at each time point with two for loops. I have done that on several subsets of trials for the trainng and test it on several subsets of testing trials.
I then used the function you have updated and got very very similar results!
Is the cross validation not needed because the datasets for training and testing are different?

Thank you very much,
bests,

Federica