[pymvpa] clf generalization over a different set of classes

Yaroslav Halchenko debian at onerussian.com
Tue Aug 4 15:25:51 UTC 2009


first the short answer:
> This shows an accuracy of about 40 % ... however changing the
> assignment of the faked labels to:
> >...<
> leads to an accuracy of about 60 %. I am not sure if this makes
> sense, or if I missed something here. For making a statement like
to say more, those should add up to a 100% ;) because whatever was
classified 'correctly' in the first mapping became misclassification in
the 2nd, and vise versa. So, mean of those will be 50% all the time ;)

But I guess you should have an idea on what mapping you like 4,5 -> 1,2
or 5,4 -> 1,2  toward you hypothesis to choose the one.

Now  a bit of Pythonization
> for l in xrange(tmp_labels.shape[0]):
>    if tmp_labels[l] == 4.0:
>        new_labels[l]=2.0
>    elif tmp_labels[l] == 5.0:
>        new_labels[l]=1.0
I guess smth like
new_labels[tmp_labels == 4.0] = 2.0
new_labels[tmp_labels == 5.0] = 1.0
or even
new_labels = old_labels - 3
in case of mapping 4,5 -> 1,2
should suffice

> terr.states.enable('confusion')
> terr(ds1, ds1)
I guess you are trying to estimate training_confusion which is available
as the state of the classifier

> error = terr(ds1, ds2)   print terr.confusion
btw -- terr call is taking first testing dataset and then optional
training (since it is not always necessary):

*In [4]:TransferError.__call__?
Type:		instancemethod
Base Class:	<type 'instancemethod'>
String Form:	<unbound method TransferError.__call__>
Namespace:	Interactive
File:		/usr/lib/pymodules/python2.5/mvpa/clfs/transerror.py
Definition:	TransferError.__call__(self, testdataset, trainingdataset=None)

So, I guess you might like to actually use terr(ds2, ds1)? (of cause I could be
wrong since it depends on what you are trying to do actually ;))

btw, for imho clean  analysis and not that clean (if anywhere
significant/valuable) results of transfer from one data to another, see
recent

http://www.sciencemag.org/cgi/content/abstract/1171599

Published Online May 7, 2009
Science DOI: 10.1126/science.1171599

Recruitment of an Area Involved in Eye Movements During Mental Arithmetic

André Knops, Bertrand Thirion, Edward M. Hubbard, Vincent Michel,
Stanislas Dehaene

Throughout the history of mathematics, concepts of number and space
have been tightly intertwined. We tested the hypothesis that cortical
circuits for spatial attention contribute to mental arithmetic. We
trained a multivariate classifier to infer the direction of an eye
movement, left or right, from the brain activation measured in
posterior parietal cortex. Without further training, the classifier
then generalized to an arithmetic task. Its left versus right
classification could be used to sort out subtraction versus addition
trials, whether performed with symbols or with sets of dots. These
findings are consistent with the suggestion that mental arithmetic
co-opts parietal circuitry associated with spatial coding.

-- 
                                  .-.
=------------------------------   /v\  ----------------------------=
Keep in touch                    // \\     (yoh@|www.)onerussian.com
Yaroslav Halchenko              /(   )\               ICQ#: 60653192
                   Linux User    ^^-^^    [175555]





More information about the Pkg-ExpPsy-PyMVPA mailing list