Hi Dave,
1200 beta values is a lot and will take a while, but at the same time, one year is a lot, as well, so something seems to be off. Since the runwise LSA already takes so long (I would expect no more than 15 minutes in your case), this already narrows the problem down.
Since you seem quite experienced with Matlab, the first thing you can try is identify the bottleneck yourself, using the Matlab profiler. Type profile on
into the command window. Then execute your code, wait for 5-15 minutes (depending on how long it takes to load your data this may otherwise obscure results). Then cancel execution with CTRL + c
, and then execute profile off
and profile viewer
. You will get a nice html through which you can navigate the code tree structure, the number of times each line was executed, and the time each line took to run, to identify the culprit. My guess it is the classifier itself, rather than an integral part of TDT.
For simplicity, keep the problem focused on two classes and LSA at the moment, only then try it with LSS and finally all 8 classes. Also, turn off displaying the searchlight while it is running (should only really affect speed if you plot more than every 100th searchlight). Finally, run only 100 searchlights, which will give you a more precise estimate of the time it takes.
rng(3) % get reproducible subset
cfg.searchlight.subset = sort(randsample(1:170000, 100)); % get random sample
First, try changing the classifier from LIBSVM to the correlation classifier and see if it speeds things up (else this might be a more complicated problem).
cfg.decoding.software = 'correlation_classifier;
cfg.decoding.method = 'classification';
If this speeds things up, then switch those options back to 'libsvm'
and 'classification_kernel'
and try scaling the data. The reason is that the classifier likes input data that is somewhat in a small range, and perhaps LSS and LSA don’t do that for you, but you can achieve it by scaling (e.g. by z-transforming or by scaling between 0 and 1). If it is not scaled, sometimes the classifier can take a long time.
cfg.scale.method = 'z';
cfg.scale.estimation = 'all';
If this improves LSA, this will likely also improve LSS. Maybe not sufficiently, though, because you still have an interesting case: usually the number of dimensions (i.e. voxels, P) is smaller than the number of data points (i.e. beta maps, N), making it super easy for the SVM to find a solution. When P > N, will take longer to find a solution. A simple workaround is to slightly reduce the C parameter to 0.1 or 0.01 or even 0.001, which normally shouldn’t strongly affect your results but can work miracles. It might in this case also make sense to compare the speed for running classification
vs. classification_kernel
, where kernel is usually faster.
Let me know if any of this helped or whether you are still stuck at slow execution. I think it should in total not take longer than a few hours to run, and there are other strings to pull to speed things up.
Best,
Martin