[pymvpa] Using PLR with multiclass
Swaroop Guntupalli
swaroopgj at gmail.com
Wed Mar 1 18:38:26 UTC 2017
Does it help if you assign targets in your sample attributes to {0,1}
instead?
On Wed, Mar 1, 2017 at 1:13 PM, Neal Morton <mortonne at gmail.com> wrote:
> 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>
>
> clf.train(ds1)
>
> File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/base/learner.py",
> line 137, in train
>
> self._train(ds)
>
> 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
>
> clf.train(dataset)
>
> File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/base/learner.py",
> line 137, in train
>
> self._train(ds)
>
> File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/clfs/meta.py",
> line 1053, in _train
>
> self.clf.train(datasetselected)
>
> File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/base/learner.py",
> line 137, in train
>
> self._train(ds)
>
> File "/work/IRC/ls5/lib/python2.7/site-packages/mvpa2/clfs/plr.py",
> line 76, in _train
>
> %(set(d),)
>
> 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
> <https://github.com/PyMVPA/PyMVPA/issues/37> in PLRWeights to support
> different values of labels, but that change doesn’t seem to have affected
> the PLR classifier.
>
>
>
> Thanks,
>
> Neal
>
>
>
> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20170301/534f814d/attachment.html>
More information about the Pkg-ExpPsy-PyMVPA
mailing list