[pymvpa] PyMVPA searchlight command is freezing up

Sarah Helfinstein shelfins at gmail.com
Wed Oct 3 15:07:17 UTC 2012

Thanks for the suggestions! I tried the GNB() classifier, and it did work
with that one, so I think it may be an issue with the SVM() classifier not
converging. Is there anything you can do about that? I'd be happy to pass
along my data if it would be helpful.


Message: 2
Date: Mon, 1 Oct 2012 12:11:39 -0400
From: Yaroslav Halchenko <debian at onerussian.com>
To: pkg-exppsy-pymvpa at lists.alioth.debian.org
Subject: Re: [pymvpa] PyMVPA searchlight command is freezing up
Message-ID: <20121001161139.GI26676 at onerussian.com>
Content-Type: text/plain; charset=utf-8

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
>    and I'm hoping someone out there can shed some light on what's
>    I'm running two MVPAs on my data, one where I pull out the data from
>    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
>    searchlight (so I can look at classification ability due to
differences in
>    mean activation btwn categories separately from classification ability
>    to differences in the pattern of activation btwn categories.) The
>    where I subtract the mean from each voxel in the searchlight runs
>    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
>    It always stops on the same searchlight, so clearly there's something
>    about the data in that searchlight that is tripping up the
>    command, but I cannot figure out what. Has anyone else ever had
>    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
" +
>    str(datetime.datetime.now())
>    ??? cvte = CrossValidation(classifier, NFoldPartitioner(),
>    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

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20121003/12a72fbf/attachment.html>

More information about the Pkg-ExpPsy-PyMVPA mailing list