support vector machines

Support Vector Machines COMP 640 Ryan Spring, Sarah Kim - PowerPoint PPT Presentation

Support Vector Machines COMP 640 Ryan Spring, Sarah Kim Quiz Example SoluBons What is classificaBon? F(x) = -1 Not Spam F(x) = +1 Spam


  1. Support ¡Vector ¡Machines ¡ COMP ¡640 ¡ Ryan ¡Spring, ¡Sarah ¡Kim ¡

  2. Quiz ¡Example ¡SoluBons ¡

  3. What ¡is ¡classificaBon? ¡ F(x) ¡= ¡-­‑1 ¡Not ¡Spam ¡ F(x) ¡= ¡+1 ¡Spam ¡

  4. How ¡should ¡I ¡divide ¡the ¡data? ¡

  5. Linear ¡Classifier ¡ Y = F ( w T x ) = ∑ w i x j

  6. MulBple ¡Possible ¡SoluBons ¡

  7. Defining ¡Features ¡of ¡SVM ¡

  8. How ¡SVM ¡works ¡ w

  9. Unknown ¡Data ¡(1) ¡ u w

  10. Unknown ¡Data ¡(2) ¡ ProjecBon ¡of ¡unknown ¡item ¡ u ¡onto ¡vector ¡ w ¡that ¡is ¡ perpendicular ¡to ¡the ¡ hyperplane ¡ u U*w ¡ w

  11. SVM ¡Decision ¡Rule ¡ ​𝑥 ∙ ​𝑣 + 𝑐 ≥0 ¡then ¡ ​ X ↓ + ¡ ​𝑥 ∙ ​𝑣 + 𝑐 <0 ¡then ¡ ​ X ↓ − ¡ u U*w ¡ w

  12. Learning ¡SVM-­‑Minimizing ¡w ¡ 𝑋𝑗𝑒𝑢ℎ = (​𝑦↓ + − ​𝑦↓ − ) ∙ ​𝑥/‖𝑥‖ ¡ Constraints: ¡ ​𝑥/‖𝑥‖ ¡ ​𝑧↓𝑗 (​𝑦↓𝑗 ​𝑥 + 𝑐) −1=0 ¡ ​𝑦↓ + − ​𝑦↓ − ¡

  13. Learning ¡SVM-­‑Minimizing ¡w ¡ 𝑋𝑗𝑒𝑢ℎ = (​𝑦↓ + − ​𝑦↓ − ) ∙ ​𝑥/‖𝑥‖ ¡ 1+ 𝑐 ¡ 1− 𝑐 ¡ Constraints: ¡ ​𝑥/‖𝑥‖ ¡ ​𝑧↓𝑗 (​𝑦↓𝑗 ​𝑥 + 𝑐) −1=0 ¡ ​𝑦↓ + − ​𝑦↓ − ¡

  14. Learning ¡SVM-­‑Minimizing ¡w ¡ 𝑋𝑗𝑒𝑢ℎ = (​𝑦↓ + − ​𝑦↓ − ) ∙ ​𝑥/‖𝑥‖ = ​ 2 /‖𝑥‖ ¡ 1+ 𝑐 ¡ 1− 𝑐 ¡ Constraints: ¡ ​𝑥/‖𝑥‖ ¡ ​𝑧↓𝑗 (​𝑦↓𝑗 ​𝑥 + 𝑐) −1=0 ¡ ​𝑦↓ + − ​𝑦↓ − ¡

  15. Learning ¡SVM ¡– ¡Minimizing ¡w ¡ Distance ¡between ¡projecBons ¡of ¡training ¡data: ¡ x ⋅ w x ⋅ w min max p ( w , b ) = | w | − | w | { x : y = 1} { x : y = − 1} When ¡maximizing ¡this ¡distance: ¡ 2 2 p ( w 0 , b 0 ) = | w 0 | = Minimize ¡this ¡ w 0 ⋅ w 0

  16. Learning ¡SVM ¡– ¡Penalizing ¡ misclassificaBon ¡ ¡ Hinge ¡Loss ¡FuncBon ¡ N ∑ C max(0,1 − y i f ( x i )) i

  17. Primal ¡Form ¡ f ( x ) = w T x + b ß ¡Classifier ¡ For ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡ ¡ w ∈ ℜ d N w ∈ℜ d || w || 2 + C ∑ min max(0,1 − y i f ( x i )) i Minimize ¡w ¡ Penalizing ¡misclassificaBon ¡ Maximize ¡margin ¡ (Hinge ¡Loss) ¡

  18. Challenges ¡ I. ¡Handling ¡error ¡(slack ¡vars.) ¡ 2. ¡Handling ¡non-­‑linearly ¡separable ¡data ¡(kernels) ¡ ¡

  19. 1. ¡Handling ¡Error ¡-­‑ ¡Slack ¡Variables ¡ ξ i ≥ 0 All ¡data ¡points ¡ 0 < ξ ≤ 1 X ¡ Inside ¡the ¡margin ¡ X ¡ ξ > 1 Misclassified ¡

  20. Slack ¡FormulaBon ¡ N w ∈ℜ , ξ i ∈ℜ + || w || 2 + C ∑ min ξ i i Subject ¡to ¡ ¡ y i ( w T x i + b ) ≥ 1 − ξ i For ¡i ¡= ¡1…N ¡

  21. 2. ¡Non-­‑Linear ¡SeparaBon ¡-­‑ ¡Dual ¡Form ¡ SoluBon ¡w ¡can ¡be ¡wriaen ¡as ¡linear ¡combo ¡of ¡training ¡data: ¡ N ∑ w = a j y j x j j = 1 SubsBtute ¡w ¡in ¡primal ¡classifier ¡ ¡ ¡ f ( x ) = w T x + b T " % N N ∑ ∑ T x ) + b f ( x ) = $ α j y j x j ' x + b = y i ( x i α i $ ' # & j = 1 i

  22. Dual ¡Form ¡Problem ¡ For ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡ ¡ ¡ w ∈ ℜ N − 1 ∑ ∑ T x k ) max α k y j y k ( x j α i α j 2 α i ≥ 0 i jk Subject ¡to ¡0 ¡≤ ¡α ¡≤ ¡C ¡for ¡ ¡ ¡ ¡ ¡, ¡and ¡ ¡ ∑ α i y i = 0 ∀ i i

  23. Kernel ¡Trick ¡ N ∑ T x ) + b Dual ¡Form ¡Classifier: ¡ f ( x ) = y i ( x i α i ¡ i ¡ N T z ) k ( x i , x ) = ( x i ∑ Kernel ¡Classifier: ¡ f ( x ) = y i k ( x i , x ) + b α i ¡ i Knowledge ¡of ¡inner ¡product ¡is ¡key ¡

  24. Example: ¡Polynomial ¡Kernel ¡ k ( x , x ') = (1 + x T x ') 2 + ¡ + ¡ + ¡ + ¡ + ¡ + ¡ -­‑ ¡ -­‑ ¡ -­‑ ¡ -­‑ ¡ -­‑ ¡

  25. Experiments ¡-­‑ ¡Classifying ¡Numbers ¡ ¡ • Postal ¡(16x16 ¡pxls): ¡7,300 ¡training, ¡2,000 ¡test ¡ ¡ • NIST ¡(28x28 ¡pxls): ¡60,000 ¡training, ¡10,000 ¡test ¡

  26. Error ¡remains ¡constant ¡with ¡ increasing ¡feature ¡space ¡size ¡ Training ¡ Bme? ¡

  27. Comparison ¡with ¡other ¡classifiers ¡

  28. Advantages ¡over ¡Neural ¡Net ¡and ¡kNN ¡ • Neural Net – Global optimum not guaranteed • Non-convex cost function – Several parameters require tuning • kNN ¡ – Curse ¡of ¡dimensionality ¡

  29. Conclusions ¡about ¡SVM ¡ • OpBmal ¡hyperplane ¡for ¡classificaBon ¡ ¡ • Universal ¡learning ¡machine ¡ – Slack ¡variables ¡(error) ¡ – Kernels ¡(non-­‑linear ¡separaBon) ¡ ¡ • Knowledge ¡of ¡inner ¡products ¡is ¡key ¡ ¡

  30. Other ¡Resources ¡ • Andrew ¡Zisserman’s ¡lectures ¡ – hap://www.robots.ox.ac.uk/~az/lectures/ml/ lect2.pdf ¡ – hap://www.robots.ox.ac.uk/~az/lectures/ml/ lect3.pdf ¡ • MIT ¡AI ¡Course ¡Video ¡ – haps://www.youtube.com/watch? v=_PwhiWxHK8o ¡

Recommend


More recommend