[pymvpa] PyMVPA searchlight command is freezing up

Yaroslav Halchenko debian at onerussian.com
Mon Oct 1 16:11:39 UTC 2012



On Mon, 01 Oct 2012, Sarah Helfinstein wrote:

>    Hi all,

>    I'm having a bit of a weird problem with a searchlight MVPA I'm running,
>    and I'm hoping someone out there can shed some light on what's happening.
>    I'm running two MVPAs on my data, one where I pull out the data from each
>    searchlight, calculate the mean for the searchlight, and subtract that
>    value from each voxel in the searchlight, and another where I calculate
>    the mean for the searchlight, then assign that value to each voxel in the
>    searchlight (so I can look at classification ability due to differences in
>    mean activation btwn categories separately from classification ability due
>    to differences in the pattern of activation btwn categories.) The script
>    where I subtract the mean from each voxel in the searchlight runs without
>    incident on my data, but when I run the one where I'm assigning the
>    searchlight mean to each voxel, the script runs fine until about the
>    2,000th searchlight and then it just....freezes. It doesn't throw an
>    error; it just goes into the crossvalidation command and never comes out.
>    It always stops on the same searchlight, so clearly there's something
>    about the data in that searchlight that is tripping up the crossvalidation
>    command, but I cannot figure out what. Has anyone else ever had something
>    like this happen to them? Or have any idea what might cause a
>    crossvalidation to freeze up like this (particularly one where you have
>    essentially one piece of information--the searchlight mean--for each
>    sample)? Here's the relevant code from the script:

>    def just_the_means(ds):
>    ��� i = 0
>    ��� while i < ds.shape[0]:
>    ������� #assign the mean value to all voxels in the searchlight������� ���
>    ��� ��� ds.samples[i,:] = numpy.mean(ds.samples[i,:])���
>    ��� ��� i = i+1
>    ��� classifier = LinearCSVMC()
>    ��� #perform a crossvalidation using the adjusted values
>    ��� print "ABOUT TO PERFORM CROSSVALIDATION FOR A SEARCHLIGHT AT TIME " +
>    str(datetime.datetime.now())
>    ��� cvte = CrossValidation(classifier, NFoldPartitioner(), errorfx=lambda
>    p, t: numpy.mean(p == t), enable_ca=['stats'])
>    ��� return cvte(ds)

related but not relevant:

* you could have your code simplified there for while loop with

  for s in ds.samples:
      s[:] = numpy.mean(s)

  which would have accomplished the same reassignment with the mean


>    #run the searchlight
>    s1 = sphere_searchlight(just_the_means, radius = 3)
>    just_the_means_results = s1(dataset)

to see if that is an effect within SVM failing to converge somehow --
just try using different classifier, e.g. GNB() for a quick check.  If
it passes with it -- then it is a problem with SVM and we will look into
it then...

Also -- you could have avoided custom code above ( I believe) with just
using a MappedClassifier(classifier, mean_feature()) within a
conventional CrossValidation() without coming up with a custom
just_the_means()

-- 
Yaroslav O. Halchenko
Postdoctoral Fellow,   Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        



More information about the Pkg-ExpPsy-PyMVPA mailing list