Cross-validated RSA with pyMVPA (what am I doing wrong?)

I’m hoping someone can help me troubleshoot this code. As might be obvious from my previous pyMVPA post, I’m a pyMVPA novice, and my basic sanity check is failing.

What I’m trying to do – Given 4 runs with 4 conditions, I’d like to create a cross-validated Euclidean DSM.

The sanity check – I’d expect the distance between the identical conditions (the “diagonal” to be the smallest)

cds = fmri_dataset(samples=
mask=’/om3/group/saxelab/EMOfd/ROI_MASKS/disgust_meta_190611_C05_1k_ALE.nii’)[‘oddeven’] = [‘odd’,‘even’,‘odd’,‘even’,‘odd’,‘even’,‘odd’,‘even’,

cds_split1 = cds[ == ‘odd’]
cds_split2 = cds[ == ‘even’]

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

The problem: The smallest distances are not, in fact, along the diagonal.

Thoughts? It’s possible the first-level model was wrong, but since this is the piece I’m least familiar with, I thought I’d start here.


Hi @toddt!

this thread is a bit dated, but I still wanted to ask if you managed to solve your problem? I have a similar problem, where I can’t get CDist to work with searchlight.