[pymvpa] SampleGroupMapper question

Matthias Ekman Matthias.Ekman at nf.mpg.de
Wed Jul 1 09:41:56 UTC 2009


Hi,

Yaroslav Halchenko wrote:
> On Tue, 30 Jun 2009, Matthias Ekman wrote:
>   
>> So far so good :-) Is it also possible to apply the same mapping to the  
>> SamplesAttributes? Something like:
>>
>> mapped_attr = attr.applyMapper(samplesmapper=m)
>>     
> Unfortunately not at the moment, BUT if it is needed, we will make it ;)
>   
Oh thanks, that's very kind, but I think I'll better try to code this on 
my own, cause it might be not that useful for a lot of other pymvpa 
users. Just wanted to be sure, that I am not missing something which 
already exists.
>> I just want a new txt-file with the corresponding (mapped) attributes.  
>> If nothing like this exists, it should be very easy to recode my  
>> existing attributes file externally (bash, python whatever)... but... I  
>>     
>
> yeah -- probably the best is to do that just right in that script of yours ;)
> but indeed we should just adjust it so it could operate on any set of
> sample attributes (which have unique values).  Would you mind sharing a
> usecase why do you need that and what custom attribute do you create with
> SamplesAttribute?
>
>   
I just want to perform the decoding analysis on trial averaged volumes. 
Right now, I am using fsltools (fslsplitter/fslmerge/fslmaths) to 
achieve this. Its working fine, but very, very slow. PyMVPAs 
Groupsamplemapper could do this job ten times faster. My idea was to 
give volumes which should be merged together an unique (faked) 
attribute. After doing so, I want to reload the mapped data with the 
right attributes and run my analysis.

As you can see, I am not that interested in the 'original' function of 
the SampleGroupMapper,.. :-)
>   
>> was not able to find out how the mapper works internally. Especially  
>>     
> hm... just look at the source code -- it is all there in 'forward'
> method of the SampleGroupMapper
>
> in ipython that is as easy as
>
> SampleGroupMapper??
>   

Ok, next time I will have a closer look at the source code before 
asking. Haven't used ipython before - to be honest I am one of those "Oh 
no, not another one, I already have to learn about PyMVPA." ;-) - .. but 
this is really a cool feature! Might be worth to have a closer look. 
Thanks for the hint
>   
>> what the the 'new sample' order looks like. Is it depending on the first  
>> appearance of a sample in each chunk?
>>     
> it is based on the order of uniquechunks and then uniquelabels. Here is
> the actual code:
>
>        mdata = []
>
>         # for each label in each chunk
>         for c in self.__uniquechunks:
>             for l in self.__uniquelabels:
>                 mdata.append(self.__fx(data[N.logical_and(self.__labels == l,
>                                                           self.__chunks == c)]))
>
>         return N.array(mdata)
>
>   
Ok, thanks for the pointer!
>> Would be very nice to hear your opinion on the following questions:
>> Would you perform the detrending before or after mapping?
>>     
>
> usually it is worth to do ALL preprocessing first and store the preprocessed
> data so you don't need to do that for every modification of your analysis.  I
> don't think that detending after applying SampleGroupMapper would make any
> sense since it does change the ordering of samples
>   
mh .. I see.. but may be in my case (trial average) it would make sense, 
because I am "just" reducing the number of samples and I am not 
affecting the sample order, right?
>   
>> The samplemapping really improves my decoding accuracy very much. I  
>> assume this is because of noise reduction? Could you think of another  
>> reason which might be not intended?
>>     
>
> could be many things, but most probably indeed just noise reduction. It
> could also obliterate non-linear effects a bit imho.
>
>   
Thanks for your expertise on this. In my case, my data consists of 12 
chunks. The samplegroupmapper boosts my accuracy about 30 % ... but 
would you belief an analysis showing 95% ACC based on 12 decisions :-) ?

thanks again for your help!
Matthias



More information about the Pkg-ExpPsy-PyMVPA mailing list