[pymvpa] RFE question #1 - short version

Michael Hanke michael.hanke at gmail.com
Tue Nov 24 11:33:33 UTC 2009


Hi,

sorry for not replying earlier.

On Mon, Nov 23, 2009 at 10:28:29PM -0800, Mark Lescroart wrote:
> Hello,
> 
> Real quick:  Besides "None", what other arguments can you input for
> "combiner=???" in a sensitivity analyzer for a feature selection
> classifier? I see that it's supposed to be a "functor", whatever
> that is, but some examples would be very helpful.

A functor is a function object:

  http://en.wikipedia.org/wiki/Function_object

Anything that can be called (a function object, a class with __call__, a
lambda function) can serve as a combiner. The combiner is called with
the original result and its return value in turn becomes the result.

Functors could be:

>>> import numpy as N

Grand mean (please note the absence of the () at the end)
>>> functor = N.mean

Lambda function to multiple any input by two
>>> functor = lambda x: x*2

More realistic combiner: mean along the first axis of an array
>>> functor = lambda x: N.mean(x, axis=0)


HTH,

Michael


-- 
GPG key:  1024D/3144BE0F Michael Hanke
http://mih.voxindeserto.de



More information about the Pkg-ExpPsy-PyMVPA mailing list