Split half classification

Hi there ~

I was wondering if it is possible to switch from leave-out-run-out classification to a split half classification using the toolbox.

What I have tried so far is changing the chunks and the design.train & design.test input:
With 4 runs, the design.train for the leave-one-run-out looks like this (4x8):
image

however in a split half classification it should be 4x12 for all possible combinations and the design should look like this:

But this returns an error that there are not enough files (betas) to run the decoding, so it is definitely not enough as the number of betas should match the number of steps.

Thank you for your answers

Best,
Emma

Hi Emma,
Which tool do you use ?
Best,
Bertrand

Hey Emma,

you’re on track: you can indeed simply adapt cfg.design.train and cfg.design.test to create a split-half design, but it seems you mixed up the dimensions.

In your example you have 8 images for classification, 4 per run. The typical split-half design is to first train on all data from odd runs and test on all data from even runs, and then switch training and test set.

Thus, a split-half design would need .train and .test 8x2 matrices (8 betas, 2 “steps”).

You can either create these manually, e.g. by setting

cfg.design.train = [
    1 0;
    0 1;
    1 0;
    0 1;
    1 0;
    0 1;
    1 0;
    0 1]
cfg.design.test = [
    0 1;
    1 0;
    0 1;
    1 0;
    0 1;
    1 0;
    0 1;
    1 0]

Note that you also need to adapt the matrix cfg.design.label, because this also contains one column for each step. Because the labels are always the same per step, you need to just keep the first two columns:

cfg.design.label = cfg.design.label(:, 1:2)

However, a more general way to create the cfg.design.train and .test matrix would be the following, in which we first determine which data comes from odd runs using the modolo (mod) function and use this for the first .train column, then invert this to get all data from even runs for the second column, and then invert the whole .train matrix to get all left-out data as test. Finally we again reduce the .label matrix to two columns. Note the difference between cfg.files and cfg.design

% create a odd-even split-half decoding design 
cfg.design.train = mod(cfg.files.chunk, 2);       % step 1: train on all odd data
cfg.design.train(:, 2) = ~cfg.design.train(:, 1); % step 2: train on all even data
cfg.design.test = ~cfg.design.train;              % test on left-out data in step 1 and 2
cfg.design.label = cfg.design.label(:, 1:2);      % same shape for design.label as for .train and .test

Hope that helped?

Best
Kai

1 Like

Short PS: You might also need to adapt the length of cfg.design.set. To do so, just call

cfg.design.set = cfg.design.set(:, 1:2);

The resulting design matrix should look like this:

Best
Kai

1 Like

Hi Kai,

thank you for your reply and your solution. Sorry for the delay, I’ve been on leave. Indeed I had confused the dimensions of the matrices for the split half classification. Your solution works very well, thank you :slight_smile:

Best,
Emma

1 Like

Hi

It’s the decoding toolbox.