Successfully reported this slideshow.
Upcoming SlideShare
×

First Step SVM

421 views

Published on

I wrote first step Support Vector Machine.

Published in: Technology
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

First Step SVM

1. 1. First Step SVM Yoshinobu Tanno http://ytanno.herokuapp.com/
2. 2. Introduction ( How to ) 0. Plot of data 1. The definition of the border 2. Determine the distance of the border line and the point ( each all points) 3. Select boarder that is lowest value of average 2. distance 4. Plot of 3. Line 5. Where is Sample Code ?
3. 3. 0. Plot Data • Very Easy !
4. 4. 1 The definition of the border • Determine the perpendicular line of each of the two points Point Data P1(p1x,p1y) P2(p2x,p2y) Midpoint M( (p1x + p2x) / 2.0, (p1y + p2y) / 2.0) = M(mx, my) Perpendicular define y = ax + b a = - 1.0 / ( (p1y – p2y ) / (p1x – p2x) ) b = my – mx * a
5. 5. These Line are candidate border
6. 6. Determine the distance of the border line and the point P(px,py) y=ax+b S(0,b) θ distance A(1,a+b) cosθ = P ・ A / |P||A| = (px * 1 + a * (py –b)) / ( (√1 + a^2) * (√px^2 + (py-b)^2)) Θ = acos(cosθ) Distance = |P|sinθ = (√px^2 + (py-b)^2)) *sinθ P(px,py-b) y=axS(0,0) θ distance A(1,a)
7. 7. Select boarder that is lowest value of average distance • For example y=-0.438x + 54.719 avg dist 16.016 Best Border Line ! y=-9.400x + 522.000 avg dist 19.719 y=0.923x + 21.038 avg dist 35.785 y=1.500x + -62.500 avg dist 27.957 y=3.636x + -157.682 avg dist 24.643 y=0.654x + 27.691 avg dist 34.961 y=-3.200x + 146.900 avg dist 16.268 y=0.446x + 49.892 avg dist 42.602 y=0.186x + 56.821 avg dist 39.556
8. 8. Plot of 3. Line • Complete !
9. 9. Where is sample code ? • https://github.com/ytanno/svm