[pymvpa] Combine the fMRI data with other data in the pattern analysis?

Michael Hanke michael.hanke at gmail.com
Tue Mar 15 12:40:38 UTC 2011


On Tue, Mar 15, 2011 at 10:40:36AM +0100, Nynke van der Laan wrote:
> Dear Yaroslav, Micheal and Francisco,
> 
> thank you very much for the quick replies, it's great that there is
> such an active discussion list!
> I initially tried the method that Michael proposed. I tried the code
> below but I get an error message: NameError: name 'MyMeasure' is not
> defined.

Yeah, sorry -- that was a bit too terse (see below).

> The covariate_ds exists of 38 values (here just example values)
> because I have one value for the covariate for each sample (each block
> averaged category per trial).
> One thing was not yet clear to me: how is the covariate treated when i
> implement it in this way? Is it used as an additional feature?

First you need to make 'MyMeasure' -- draft, not tested:

class MyMeasure(Measure):
	def __init__(self, measure, cov)
		self._msre = measure
		self._cov = cov

	def _call(self, ds):
		cov_ds = mvpa.base.dataset.hstack(ds, cov)
		return self._msre(cov_ds)

Hmm, the following code it for 0.4 (I wrote the code for 0.6).

> cv = CrossValidatedTransferError(
>          TransferError(LinearNuSVMC()),
>          NFoldSplitter())
> covariate_ds = [1,2,3,4,5,6,7,8,3,5,4,5,4,4,3,4,5,4,3,4,5,6,7,8,9,7,5,4,5,6,7,8,7,4,3,3,3,4]

This should become (again 0.6 code):

covariate_ds = Dataset([1,2,3,4,5,6,7,8,3,5,4,5,4,4,3,4,5,4,3,4,5,6,7,8,9,7,5,4,5,6,7,8,7,4,3,3,3,4])

> m=MyMeasure(cv, covariate_ds)
> sl = Searchlight(m, radius=6)


Does that make sense.

Michael

-- 
Michael Hanke
http://mih.voxindeserto.de



More information about the Pkg-ExpPsy-PyMVPA mailing list