[pymvpa] Using PLR with multiclass

Neal Morton mortonne at gmail.com
Wed Mar 1 18:13:33 UTC 2017

Is there a way to use PLR with a multiclass problem? When I try to use the MulticlassClassifier, that produces binary labels with -1 and 1. But PLR expects 0 and 1.


The classifier is created like so:


from mvpa2.clfs.plr import PLR

from mvpa2.clfs.meta import MulticlassClassifier

clf = MulticlassClassifier(PLR(lm=10))


When I try to train the classifier on an fMRI dataset with four classes, I get:


Traceback (most recent call last):

  File "/home1/03206/mortonne/analysis/bender/mvpa/loc_xval_diag.py", line 98, in <module>


 File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/base/learner.py", line 137, in train


  File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/clfs/meta.py", line 1165, in _train

    CombinedClassifier._train(self, dataset)

  File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/clfs/meta.py", line 628, in _train

    BoostedClassifier._train(self, dataset)

  File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/clfs/meta.py", line 118, in _train


  File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/base/learner.py", line 137, in train


  File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/clfs/meta.py", line 1053, in _train


  File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/base/learner.py", line 137, in train


  File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/clfs/plr.py", line 76, in _train


ValueError: Regressors for logistic regression should be [0,1]. Got set([1, -1])



I have the latest versions of meta.py and plr.py. There was a change in PLRWeights to support different values of labels, but that change doesn’t seem to have affected the PLR classifier.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20170301/e0dcbc82/attachment.html>

More information about the Pkg-ExpPsy-PyMVPA mailing list