[pymvpa] sphere_gnbsearchlight & Monte Carlo Testing
wolf zinke
wolf.zinke at ovgu.de
Thu Oct 11 16:17:30 UTC 2012
Hi,
With some great input from Michael I figured out now, that contrary to
the common sphere_searchlight, the sphere_gnbsearchlight already
implements a cross-validation. So the code got modified now as pasted
below. This code runs without any error. However, the
sl.ca.null_prob.samples have all the same value. This is not the case
for the 'common' searchlight implementation (second snippet below).
Has anybody an idea, where the code is wrong, making MCNullDist always
produce the same permutation?
Thanks for any hints,
wolf
### GNB-Searchlight
clf = GNB()
splt = NFoldPartitioner(cvtype=2, attr='chunks')
repeater = Repeater(count=100)
permutator = AttributePermutator('targets', limit={'partitions': 1},
count=1)
null_sl = sphere_gnbsearchlight(clf, ChainNode([splt, permutator],
space=splt.get_space()),
radius=3, space='voxel_indices',
enable_ca=['roi_sizes'],
postproc=mean_sample(),
errorfx=mean_mismatch_error)
distr_est = MCNullDist(repeater, tail='left', measure=null_sl,
enable_ca=['dist_samples'])
sl = sphere_gnbsearchlight(clf,splt, radius=3, space='voxel_indices',
enable_ca=['roi_sizes'], reuse_neighbors=True,
null_dist=distr_est, postproc=mean_sample(),
errorfx=mean_mismatch_error)
sl_map = sl(ds)
### 'normal' Searchlight
clf = GNB()
splt = NFoldPartitioner(cvtype=2, attr='chunks')
repeater = Repeater(count=100)
permutator = AttributePermutator('targets', limit={'partitions': 1},
count=1)
null_cv = CrossValidation(clf, ChainNode([splt,
permutator],space=splt.get_space()),
postproc=mean_sample())
null_sl = sphere_searchlight(null_cv, radius=3, space='voxel_indices',
enable_ca=['roi_sizes'], nproc=4)
distr_est = MCNullDist(repeater,tail='left', measure=null_sl,
enable_ca=['dist_samples'])
cv = CrossValidation(clf,splt, errorfx=mean_mismatch_error,
enable_ca=['stats'], postproc=mean_sample() )
sl = sphere_searchlight(cv, radius=3, space='voxel_indices', nproc=4,
enable_ca=['roi_sizes'], null_dist=distr_est)
sl_map = sl(ds)
On 10/09/2012 04:49 PM, wolf zinke wrote:
> Hi,
>
> I try to use sphere_gnbsearchlight for Monte Carlo Testing to speed
> things up a bit. After figuring out the difference of arguments
> between sphere_gnbsearchlight and sphere_searchlight, I was able to
> set up everything without an argument error. However, when I run the
> searchlight analysis, it produces an error. Maybe, I misunderstood the
> usage of the arguments for sphere_gnbsearchlight, especially the
> generator argument. Any ideas what I am doing wrong here?
>
> thanks,
> wolf
>
> clf = GNB()
> splt = NFoldPartitioner(cvtype=2, attr='chunks')
> repeater = Repeater(count=100)
> permutator = AttributePermutator('targets', limit={'partitions': 1},
> count=1)
> null_cv = CrossValidation( clf, ChainNode([splt, permutator],
> space=splt.get_space()), errorfx=mean_mismatch_error,
> postproc=mean_sample())
> distr_est = MCNullDist(repeater, tail='left', measure=null_cv,
> enable_ca=['dist_samples'])
> cv = CrossValidation(clf, splt, errorfx=mean_mismatch_error,
> enable_ca=['stats'], postproc=mean_sample(), null_dist=distr_est)
> sl = sphere_gnbsearchlight(clf, cv, radius=3, space='voxel_indices',
> enable_ca=['roi_sizes'])
>> ---------------------------------------------------------------------------
>> ValueError Traceback (most recent call
>> last)
>>
>> /home/data/exppsy/zinke/binding/pub_related/mvpa_splitset_epispace/comb/<ipython
>> console> in <module>()
>>
>> /usr/lib/pymodules/python2.6/mvpa2/base/learner.pyc in __call__(self, ds)
>> 237 "used and auto training is
>> disabled."
>> 238 % str(self))
>> --> 239 return super(Learner, self).__call__(ds)
>> 240
>> 241
>>
>> /usr/lib/pymodules/python2.6/mvpa2/base/node.pyc in __call__(self, ds)
>> 82
>> 83 self._precall(ds)
>> ---> 84 result = self._call(ds)
>> 85 result = self._postcall(ds, result)
>> 86
>>
>> /usr/lib/pymodules/python2.6/mvpa2/measures/searchlight.pyc in
>> _call(self, dataset)
>> 132
>> 133 # pass to subclass
>>
>> --> 134 results = self._sl_call(dataset, roi_ids, nproc)
>> 135
>> 136 if 'mapper' in dataset.a:
>>
>> /usr/lib/pymodules/python2.6/mvpa2/measures/adhocsearchlightbase.pyc
>> in _sl_call(self, dataset, roi_ids, nproc)
>> 366 # labels
>>
>> 367 combinations[:, 0] = labels_numeric
>> --> 368 for ipartition, (split1, split2) in enumerate(splits):
>> 369 combinations[split1.samples[:, 0], 1+ipartition] = 1
>> 370 combinations[split2.samples[:, 0], 1+ipartition] = 2
>>
>> ValueError: need more than 1 value to unpack
>
>
>
>
> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20121011/13c1ac87/attachment.html>
More information about the Pkg-ExpPsy-PyMVPA
mailing list