TDT problem with cross classification analysis



Dear all,

I have ran an language experiment with participants reading two class of words (A, B) in two languages (L1, L2). I would like to train the data in one language (A, B in L1) and then test on words in the other language (A,B in L2). I’m using a searchlight approach and beta images from SPM as files.

This is (part of) my code:

regressor_names = design_from_spm(beta_loc);
labelname1A = ‘xA’; labelname2A = ‘yA’; labelname1B = ‘xB’; labelname2B = ‘yB’;
cfg.files.mask =‘directory with mask’;
cfg = decoding_describe_data(cfg,{labelname1A labelname2A labelname1B labelname2B},[1 -1 1 -1],regressor_names,beta_loc,[1 1 2 2]); = make_design_xclass_cv(cfg);
cfg.results.output = {‘accuracy_minus_chance’, ‘accuracy’,‘sensitivity_minus_chance’,‘sensitivity’,‘specificity_minus_chance’,‘specificity’};
cfg.decoding.method = ‘classification’;
results = decoding(cfg);

However, when I run the analysis, I get the following error message:

searchlight: 1/174294, time to go: 03:46:35, time running: 00:00:00, finish: 2018/09/05 15:22:44
Error using libsvm_test (line 50)
libsvm’s svmpredict returned empty predictions - please check your design, whether the model was passed properly, or whether you are using the correct version of svmpredict.
Error in decoding (line 548)
decoding_out(i_step) = cfg.decoding.fhandle_test(labels_test,data_test,cfg,model); %#ok

Does anybody have an idea of what I’m doing wrong?
Many thanks


Hi Simone,

I’m not sure what could be wrong, but somewhat libsvm predictions are empty. Likely, something in the data is already off (e.g. all numbers are the same). Since it’s difficult to know what your data look like, I would recommend looking at the design matrix and checking if it looks normal (probably it does). Good old debugging will likely get you there. Go to the console and type

edit libsvm_test.m

then navigate to line 40 and set a break point (by clicking on the little horizontal line next to the line number). Then re-run the code. The first time around is a basic check, so you can type dbcont in the command line. The second time around, inspect the relevant variables (data_test, labels_test, model). If model is empty, the problem already occurs for libsvm_train, then just redo there.

Another thing you could do is change the classifier to see if the problem persists. My guess is it would but it might be worth a try.



Dear Martin,

thanks, I’ve fixed the issue!