[pymvpa] SMLR weights

Daqiang Sun sundaqiang at yahoo.com
Thu Jan 22 18:24:00 UTC 2009


Dear Yaroslav and Micheal,
Many thanks for your prompt and informative responses. I'll try to run them and 
will come back when I have problems. I'm very new to PyMVPA and to Python now 
but I've found them exciting and will keep digging. 
Hopefully I can contribute some in the future.
Congratulations for the papers!
Best, Frank 

ps: BTW, I went to a talk Per gave at UCLA. It was so good and convincing.

---------------------------
Daqiang Sun
Clinical Neuroscience Lab
Department of Psychology
UCLA
---------------------------



----- Original Message ----
From: Yaroslav Halchenko <debian at onerussian.com>
To: pkg-exppsy-pymvpa at lists.alioth.debian.org
Sent: Thursday, January 22, 2009 8:54:50 AM
Subject: Re: [pymvpa] SMLR weights

> I just started learning PyMVPA and ran some structural imaging data of patients and controls.

I think I had idea for a similar project to what you are doing, even got some
data but never finished it ;) So, let me just prime you that Python + PyMVPA should be
the right tool ;)

> To get SMLR weights, I tried both SMLRWeights(SMLR()) and SMLR().getSensitivityAnalyzer(). Although they give the same selected voxels, but the values are different. Which one should I use?

actually any, BUT...

I think that you hit a bit of inconsistency of 'default arguments'. If
you run

sana1 = SMLRWeights(SMLR())
sana2 = SMLR().getSensitivityAnalyzer()

and then print their representations:

In [3]:sana1
Out[3]:SMLRWeights(clf=SMLR())

In [4]:sana2
Out[4]:SMLRWeights(clf=SMLR(), combiner=<function SecondAxisMaxOfAbs at 0x2ae989d65ed8>)

you see that in the 2nd case you obtain a default combiner (across
various labels), which takes maximal sensitivity, whenever in the first one it
remains with the default one, which, is actually not printed since it is
default one, but it is:

In [20]:sana1._FeaturewiseDatasetMeasure__combiner
Out[20]:<function SecondAxisSumOfAbs at 0x2ae989d65e60>

NB I just pushed commit which exposes combiner and transformers (e.g. as
   'sana1.combiner')

to analyze what has actually happened we can create a sensitivity
analyzer without any combiner (which imho should be our default):

sana3 = SMLR().getSensitivityAnalyzer(combiner=None)
sens3 = sana3(dataset)

sens3.shape
Out[23]:(530, 2)

whenever for the first 2 we had:

In [24]:sens1.shape
Out[24]:(530,)

In [25]:sens2.shape
Out[25]:(530,)

and actual values:

In [26]:sens1[:5]
Out[26]:array([ 0.        ,  0.61533554,  0.30644191,  0.4684788 ,  0.14939858])

In [27]:sens2[:5]
Out[27]:array([ 0.        ,  0.5879101 ,  0.15376068,  0.27464827,  0.09092551])
a
In [28]:sens3[:5]
Out[28]:
array([[ 0.        ,  0.        ],
       [-0.58819795,  0.02891341],
       [-0.15264051,  0.15382499],
       [ 0.27456963, -0.19295715],
       [ 0.09099318, -0.06050513]])

> I assumed that the dot product of weights and selected voxel values
> (gray matter density in my case) would give an idea about how the two groups
> could be separated, but it looks not the case. Although the prediction accuracy
> is pretty good (85%), the dot products for the two groups are largely
> overlapped. I guess I just misunderstood it. Could you give me some idea about
> what the weights are about? 

Weights for linear classifier are just coefficients of the normal of the
separating plane ;) just than banal ;)

so, I think you just need to look at those sensitivity values -- check out 
doc/examples/sensanas.py

if you want to get idea on how each sample is important for the classification,
then it is a different story and you should follow Michael's advice to checkout
doc/examples/pylab_2d.py example.

> Thanks for providing such an excellent package!

hopefully you find it useful (and I bet you will after you help us out to
sort out all kinds of problems like the one you encountered. BTW -- we very
much welcome contributions : code/documentation/examples ;))

> Best regard, Frank

-- 
Yaroslav Halchenko
Research Assistant, Psychology Department, Rutgers-Newark
Student  Ph.D. @ CS Dept. NJIT
Office: (973) 353-1412 | FWD: 82823 | Fax: (973) 353-1171
        101 Warren Str, Smith Hall, Rm 4-105, Newark NJ 07102
WWW:    http://www.linkedin.com/in/yarik        

_______________________________________________
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa



      



More information about the Pkg-ExpPsy-PyMVPA mailing list