# [pymvpa] cross-validated RSA clarification/request

Todd Thompson toddt at mit.edu
Thu Jan 9 17:45:52 GMT 2020

```I'm trying to implement a cross-validated RSA on four runs of data using a
Euclidean distance measure, and I'm confused about how to use pyMVPA to do
that.

A fairly recent pyMVPA release says that I can use the CDist command to
create RDMs with cross-validated measures, but doesn't provide quite enough
detail for me to know how to do it correctly.

When I do something like this (4 runs, 4 conditions)

cds = fmri_dataset(samples=
[’run1_cgd_cope.nii.gz’,
…snip…
'run4_tgn_cope.nii.gz’],
targets=[‘cgd’,‘cgd’,‘cgd’,‘cgd’,‘cgf’,‘cgf’,‘cgf’,‘cgf’,‘cgn’,‘cgn’,‘cgn’,‘cgn’,
‘tgn’,‘tgn’,‘tgn’,‘tgn’],

cds.sa[‘oddeven’] = [‘odd’,‘even’,‘odd’,‘even’,‘odd’,‘even’,‘odd’,‘even’,
‘odd’,‘even’,‘odd’,‘even’,‘odd’,‘even’,‘odd’,‘even’]

cds_split1 = cds[cds.sa.oddeven == ‘odd’]
cds_split2 = cds[cds.sa.oddeven == ‘even’]

dsm = rsa.CDist(pairwise_metric = ‘Euclidean’)
dsm.train(cds_split1)
cres = dsm(cds_split2)

I get a 4x4 square matrix that is not symmetric, but:

1)  my diagonals aren't especially small, which makes me wonder if I'm
doing things wrong and

2) The Walther 2016 neuroimage dissimilarities paper calculates a
cross-validated metric that includes the samples from the two partitions
into a single calculation. In other words, since I have 4 conditions, I was
expecting a symmetric 4x4 matrix in which each cell in the lower triangle

Can anyone clear up my misunderstandings, or perhaps point me to a code
sample that's similar to what I'm trying to do?

Thanks, and sorry for duplicating this question here and on neurostars!
Todd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-exppsy-pymvpa/attachments/20200109/9f4379a8/attachment.html>
```