[pymvpa] Simple question about SVM output.

Yaroslav Halchenko debian at onerussian.com
Tue Feb 5 15:36:05 UTC 2013


On Tue, 05 Feb 2013, Roberto Guidotti wrote:

>    Hi all,
>    I have a simple (for you) question about SVM output, in particular about
>    *estimates* attribute. Is this the distance from SVM built hyperplane?
>    (think that yes!)
> ...
>    Is there any kind of normalization in that output? 

"estimates" is a "decision value" so it is not per se "distance" since it is
before normalization by the norm of the hyperplane.  So you would need
to get that one first to normalize estimates by if you need distance

> And in case of multiclass problem is the distance from
>    binary hyperplanes found?�

should be estimates per each pair of labels... yeap:

In [14]: from mvpa2.testing.datasets import datasets; clf = LinearCSVMC(enable_ca=['estimates']); clf.train(datasets['uni3small']); clf.predict(datasets['uni3small']); print clf.ca.estimates
[{(0, 1): 0.9999966746300938, (1, 2): 1.1311809285792367, (2, 1): -1.1311809285792367, (2, 0): -2.063934198866165, (1, 0): -0.9999966746300938, (0, 2): 2.063934198866165}, {(0, 1): 1.0000167034923464, (1, 2): -0.25189550511003067, (2, 1): 0.25189550511003067, (2, 0): -0.6494763086145185, (1, 0): -1.0000167034923464, (0, 2): 0.6494763086145185}, {(0, 1): 1.156721584442456, (1, 2): -0.12891548476258002, (2, 1): 0.12891548476258002, (2, 0): -1.000000048977625, (1, 0): -1.156721584442456, (0, 2): 1.000000048977625}, {(0, 1): 1.6462621679188452, (1, 2):....

and a "sensitivity analyzer" in this case would just produce you coefficients of hyperplanes per each binary classifier:

from mvpa2.testing.datasets import datasets; clf = LinearCSVMC(enable_ca=['estimates']); sa = clf.get_sensitivity_analyzer(); sens = sa(datasets['uni3small']); sens.sa.targets
Out[17]: array([('L1', 'L0'), ('L2', 'L0'), ('L2', 'L1')], dtype=object)

which you could use to normalize your estimates for the corresponding pair


> because in a trial made
>    on unlabeled data I have values up to 3, considering that support vectors
>    have values equal to 1 in standard formultation, it seems to me a little
>    bit strange.
>    Hope you find time to answer to my trivial questions and sorry for that!!

hope that above would help

-- 
Yaroslav O. Halchenko
Postdoctoral Fellow,   Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        



More information about the Pkg-ExpPsy-PyMVPA mailing list