<div dir="ltr">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.<div><br></div><div>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. </div><div><br></div><div>When I do something like this (4 runs, 4 conditions)</div><div><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px">cds = fmri_dataset(samples=<br>[’run1_cgd_cope.nii.gz’,<br>…snip…<br>'run4_tgn_cope.nii.gz’],<br>targets=[‘cgd’,‘cgd’,‘cgd’,‘cgd’,‘cgf’,‘cgf’,‘cgf’,‘cgf’,‘cgn’,‘cgn’,‘cgn’,‘cgn’,<br>‘tgn’,‘tgn’,‘tgn’,‘tgn’],<br>mask=’disgust.nii’)</p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px"><a href="http://cds.sa">cds.sa</a>[‘oddeven’] = [‘odd’,‘even’,‘odd’,‘even’,‘odd’,‘even’,‘odd’,‘even’,<br>‘odd’,‘even’,‘odd’,‘even’,‘odd’,‘even’,‘odd’,‘even’]</p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px">cds_split1 = cds[cds.sa.oddeven == ‘odd’]<br>cds_split2 = cds[cds.sa.oddeven == ‘even’]</p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px">dsm = rsa.CDist(pairwise_metric = ‘Euclidean’)<br>dsm.train(cds_split1)<br>cres = dsm(cds_split2)</p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px"><br></p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px">I get a 4x4 square matrix that is not symmetric, but:</p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px">1)  my diagonals aren't especially small, which makes me wonder if I'm doing things wrong and</p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px">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 had the cross-validated metric calculated.</p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px"><br></p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px">Can anyone clear up my misunderstandings, or perhaps point me to a code sample that's similar to what I'm trying to do?</p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px"><br></p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px">Thanks, and sorry for duplicating this question here and on neurostars!<br>Todd</p><p style="font-family:Helvetica,Arial,sans-serif;font-size:15px"><br></p></div></div>