Sunday, March 27, 2011

libsvm compute distance to hyperplane python

Some collections that relate to how to compute the distance to hyperplane in LibSVM in Python


https://github.com/bwallace/curious_snake

From Gábor Melis' () blog

Active Learning for cl-libsvm


Some-other-source:
http://agbs.kyb.tuebingen.mpg.de/km/bb/showthread.php?tid=1022

RE: Distance to hyperplane (/computing w) from Python?
(24-11-2008 05:27 PM)wallace Wrote:  One question though; I've noticed the si->obj value will at times be negative, and so therefore |w|^2 is as well. This seems rather odd to me. Am I perhaps doing something wrong? Thanks again.

si->obj is 
0.5 alpha^T Q alpha - sum alpha_i
= -(primal obj)
= -(w^Tw/2 + C \sum \xu_i)
<= 0

what you should use is that
alpha^TQalpha = w^Tw

in Solve of svm.cpp, we have 

g = (Qalpha - e) 

available. By calculaing alpha^T (g+e) you get
w^Tw

Hope this helps.



--

♥ ¸¸.•*¨*•♫♪♪♫•*¨*•.¸¸♥

2 comments:

  1. I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. python代写

    ReplyDelete