TDT: Decoding having only one run

Hello everyone!

I am very new to MVPA and I have a question.

The decoding examples I have seen so far (including the template script from TDT) refer to data collected in several runs, where you use some runs for training and some for testing.

I have one long run only. In this run, my conditions are repeated several times (let’s say n). Couldn’t I use the (n-1) repetitions to train my classifier and test it on the nth… etc? Or then the test and training data are not independent because they belong to the same run?
I have tried such SPM.mat but I get an error that the chunk is only 1, I suppose because of the one run:

“Empty decoding steps found in design in step(s) 1. Maybe you have only one chunk and want to do cross-validation (which doesn’t make sense).”

Should I create the SPM.mat so that each repetition is one run? It does not feel correct to do so though since I only have one run. Does anybody know?

I would appreciate any advice!

Thank you!
Konstantina

Hi Konstantina,

Since there was no tag, I didn’t see this post earlier, apologies! If you still need a reply, please let me know! The short version: set up the design manually and make sure you get several beta estimates for your different conditions. Check out our templates for that! But make sure that the data in different folds is as independent as possible.

Best,
Martin

Hi Martin,

Can you please elaborate on how I should set the design manually? Do you mean I should run a GLM using TDT myself?

I have the same issue as the original author here. I have one run, and I have 2 regressors, which are divided to 4 chunks. I have enough repetitions (20 or so per chunk), so that should be fine. I believe I should be using the unbalanced data script. I tried one of the methods explained in that file but the original error remains.

P.S. Plus, a small portion of my participants have 3 runs. So I am curious if it’s possible to perform searchlight on all my participants at the same time (both 3 run and single run participants)? Or shall I do that seperately?

1 Like

I’m also interested in more information about what is meant by “set up the design manually”… Any suggestions would be appreciated!

-Tom

It doesn’t look like anyone from TDT reads these posts… I’m wondering if TDT isn’t really supported anymore? Any suggestions on alternative toolboxes for MVPA?

Hi, Martin does seem to occasionally check this place. He may have missed it.

I wish you had tagged me instead for your query back in April. Because I have the solution.

You will need to modify your cfg.files.chunk variable before calling
cfg.design = make_design_cv(cfg);

Click Here for my code that shows how to do it.

I know it is not the simplest to understand, but basically you need to modify your chunks.

K>> cfg.files.chunk

ans =

     1
     2
     3
     4
     1
     2
     3
     4

Here, the first 1-2-3-4 correspond to the first condition, (ie. repeat position 1) there are 4 chunks. The other 4 correspond to repeat position 2. There are 4 chunks for that as well. So each number represents one chunk for the regressor/condition. You will use the same order as you defined your conditions to specify which four corresponds to which condition (ie. labelname1 corresponds to the first four here)

And also, as an alternative to TDT you can take a look at nilearn. I used it for ROI analysis, not for wholebrain but the results were similar and it should not be too difficult to set it up.

Don’t hestitate to ask if you have anyother questions. I would be happy to discuss further as I am doing lots of analysis with this data (in which I have one run) and learned some implications of this kind of data on RSA analysis as well.

Thanks for the post Tamer!

I’m not sure what you are saying here. I’ve looked at your code but I still don’t understand…

Can you explain what your experiment looks like, and then what constitutes a “chunk” for your data?

For comparison, our data are as follows: 28 sets of paired conditions (a ‘grammatical’ and an ‘ungrammatical’ version of each type of condition). We have a beta map for each of the 56 individual conditions. We want to compare grammatical vs. ungrammatical conditions using MVPA. So we want to hold out some of the conditions and use the others to form prediction equations and see how well they predict these held-out conditions. Given this, what would a “chunk” be, exactly, for our data?

Also, I don’t understand your description of your modified cfg.files.chunk file. I think I just don’t understand what “chunks” and “conditions” exactly means for your data. Are the “chunks” the sets of individual trials that you will use (the beta maps of) to form predictions for the rest of the data? Or does it mean something else? Are “conditions” things like ‘faces’ vs. ‘houses’ (for which there were several examples of different faces and several examples of different houses shown the subjects? If so, these would correspond to our “grammatical” vs. “ungrammatical” categories (though in our case we have paired stimuli, that are mostly the same, but differ in some specific way - which seems to me significantly unlike the ‘faces’ vs. ‘houses’ example, because there are not sets of pairs of ‘face’ and ‘house’ being compared).

Your statement that:
“the first 1-2-3-4 correspond to the first condition, (ie. repeat position 1) there are 4 chunks”
What does “repeat position 1” mean? I’m trying unsuccessfully to see how this would relate to our data…

Thanks for any suggestions and clarifications you can give!

It is understood that you would have trouble understanding my data. It was to give you an idea. If I were to explain my design it would be even more confusing. And a waste of time for you.

Before moving on can you tell me if you modelled things based as a beta series? For example, using a least-squares-all approachl?

Btw, let me tag @Martin because I saw him post here recently. He may also help you.

Chunks: these are groups of data. They are the samples you want to use for crossvalidation. If you have 4 chunks, and do a leave one out, you’ll CV for each chunk once in 4 iterations.

In my case a single beta estimate is an average estimate of several trials. For you I understand that one beta is an estimate for a single trial.

In that case, you’ll need to write extra code to split your data into training and test splits using the cfg.files.chunk variable and numbering them a little differently. My guess would be that, If you have 15 trials, and do a split of 3, then you’ll need to mark your trials as 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2 3 3 3 3