[pymvpa] Quick Searchlight Question

Hanson, Gavin Keith ghanson0 at ku.edu
Wed Mar 26 18:29:09 UTC 2014


Got it: I guess I’ll have give a full account of what I’m after lol

Ok, so our lab is exploring the BayesConfusionHypothesis Node within PyMVPA, as a way to get at the structure of information within the brain.
We have already looked at ROIs for this, as the tool was meant to be used, but we figured it might be interesting to get a higher resolution look at how our samples are discriminated differently across the brain, purely for visualization purposes. We’ve already accomplished this for individual participants, thanks to Dr Halchenko, and it indeed appears to be rather informative:

	https://www.mail-archive.com/pkg-exppsy-pymvpa@lists.alioth.debian.org/msg02417.html

However, we’d like to be able to create a similar map for our group of participants as a whole. According to Dr. Olivetti, this can be accomplished by using posterior probabilities from one participant as priors for the next, which will result in each participant’s information being used to update posterior probabilities, which is what we want. See:

	https://www.mail-archive.com/pkg-exppsy-pymvpa@lists.alioth.debian.org/msg02544.html

Out goal now is to combine these two approaches, which means updating priors for each sphere within the searchlight.

I’ve tried to use the pass_attr function, but I cannot make it work
        
clf=LinearCSVMC()     
cv = CrossValidation(clf, NFoldPartitioner(), pass_attr='fa.roi_seed')
sl = sphere_searchlight(cv, radius=2, add_center_fa=True)
res=sl(fds)

Gives me the error:
ValueError: Collectable 'roi_seed' with length [7] does not match the required length [1] of collection '<FeatureAttributesCollection>'.

That number [7] seems to correspond to the number of voxels in the searchlight sphere, so I’m not sure what’s going on, or what I’m doing wrong.

Ideally, we want to be able to implement the following:

fds.fa[‘priorsH’]=priors # ’priors’ = 1D object array, with each object corresponding to a vector of prior probabilities.

class ReturnBayes(Node): ## This is just what we use to make sure only the posterior probabilities are reported to the output dataset
    def _call(self, ds):
        out = np.zeros(1, dtype=object)
        out[0] = np.exp(ds.samples[:,1])
        return out
        
cv=CrossValidation(LinearCSVMC(),
                   NFoldPartitioner(),
                   errorfx=None,
                   postproc=ChainNode([Confusion(labels=fds.UT),
                                       BayesConfusionHypothesis(prior_Hs=<<PRIORS>>),
                                       ReturnBayes()]))
sl=sphere_searchlight(cv, radius=2)
res=sl(fds)
posteriors=res.samples[0,:]

Where <<PRIORS>> is an array of priors corresponding to a feature attribute associated with the ROI center/seed in the full dataset.
Note that, if you get ride of the "prior_Hs=<<PRIORS>>” stuff, then this code works perfectly well. I just want to adapt it to allow per-ROI specification of priors, to allow a kind of group level analysis.
- Gavin



On Mar 26, 2014, at 1:30 AM, Michael Hanke <mih at debian.org> wrote:

> Hi,
> 
> [this time an amazing low-latency response!]
> 
> On Tue, Mar 25, 2014 at 08:41:58PM +0000, Hanson, Gavin Keith wrote:
>> Ok, can you give me any indication of how I could do that?
>> How can I get a feature attribute in a dataset generated by a searchlight to be available to a post_proc node in a CrossValidation used as my data measure when I set up that sphere_searchlight?
>> I have no clue how to accomplish this.
> 
> There is more than one way to do it (TM).
> 
> However, the cleanest/simplest depends on your scenario -- but I know
> too little about that. My first attempt would be to use the 'pass_attr'
> argument of the CrossValidation Node to try to get the center attribute
> into the result dataset.
> 
> http://www.pymvpa.org/generated/mvpa2.base.learner.Node.html?highlight=pass_attr#mvpa2.base.learner.Node.pass_attr
> 
> I am not 100% confident that it is clever enough to work with any
> scenario, though. But still the best first attempt.
> 
> if that doesn't come out well, please drop a little sketch of your CV
> setup and we'll work it out. In the worst case by wrapping the CV Node
> into another Node that handles the attribute passage.
> 
> Let us know!
> 
> Michael
> 
> -- 
> J.-Prof. Dr. Michael Hanke
> Psychoinformatik Labor,    Institut für  Psychologie II
> Otto-von-Guericke-Universität Magdeburg,  Universitätsplatz 2, Geb.24
> Tel.: +49(0)391-67-18481 Fax: +49(0)391-67-11947  GPG: 4096R/7FFB9E9B
> 
> _______________________________________________
> 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
> 





More information about the Pkg-ExpPsy-PyMVPA mailing list