support vector machine ii
play

Support Vector Machine II Machine Learning 10-601B Seyoung - PowerPoint PPT Presentation

Support Vector Machine II Machine Learning 10-601B Seyoung Kim Many of these slides are derived fromTom 1 Mitchell, Ziv Bar-Joseph. Thanks! Max


  1. Support ¡Vector ¡Machine ¡II ¡ Machine ¡Learning ¡10-­‑601B ¡ Seyoung ¡Kim ¡ Many ¡of ¡these ¡slides ¡are ¡derived ¡fromTom ¡ 1 ¡ Mitchell, ¡Ziv ¡Bar-­‑Joseph. ¡Thanks! ¡

  2. Max ¡margin ¡classifiers ¡ • Instead ¡of ¡fiHng ¡all ¡points, ¡focus ¡on ¡boundary ¡points ¡ • Learn ¡a ¡boundary ¡that ¡leads ¡to ¡the ¡largest ¡margin ¡from ¡both ¡ sets ¡of ¡points ¡ From ¡all ¡the ¡possible ¡ boundary ¡lines, ¡this ¡ leads ¡to ¡the ¡largest ¡ margin ¡on ¡both ¡sides ¡ These ¡are ¡the ¡vectors ¡ supporKng ¡the ¡boundary ¡

  3. Support ¡Vector ¡Machines ¡ Two ¡opKmizaKon ¡problems: ¡For ¡the ¡separable ¡and ¡non ¡separable ¡cases ¡ For ¡all ¡ ¡x i ¡in ¡class ¡+ ¡1 ¡ For ¡all ¡ ¡x ¡in ¡class ¡+ ¡1 ¡ ¡ w T x+b ¡ ≥ ¡1-­‑ ¡ ε i ¡ ¡ w T x+b ¡ ≥ ¡1 ¡ For ¡all ¡ ¡x i ¡in ¡class ¡-­‑ ¡1 ¡ For ¡all ¡ ¡x ¡in ¡class ¡-­‑ ¡1 ¡ ¡ w T x+b ¡ ≤ ¡-­‑1+ ¡ ε i ¡ ¡ w T x+b ¡ ≤ ¡-­‑1 ¡ For ¡all ¡i ¡ ¡ ε I ¡ ≥ ¡0 ¡ 3 ¡

  4. Non ¡linearly ¡separable ¡case ¡ • ¡Instead ¡of ¡minimizing ¡the ¡number ¡of ¡misclassified ¡points ¡we ¡can ¡minimize ¡ the ¡ distance ¡between ¡these ¡points ¡and ¡their ¡correct ¡plane ¡ The ¡new ¡opKmizaKon ¡problem ¡is: ¡ +1 ¡plane ¡ subject ¡to ¡the ¡following ¡inequality ¡ constraints: ¡ -­‑1 ¡plane ¡ For ¡all ¡ ¡x i ¡in ¡class ¡+ ¡1 ¡ ¡ w T x+b ¡ ≥ ¡1-­‑ ¡ ε i ¡ ε k ¡ ε j ¡ For ¡all ¡ ¡x i ¡in ¡class ¡-­‑ ¡1 ¡ ¡ w T x+b ¡ ≤ ¡-­‑1+ ¡ ε i ¡ Wait. ¡Are ¡we ¡missing ¡something? ¡

  5. Support ¡Vector ¡Machines ¡ Two ¡opKmizaKon ¡problems: ¡For ¡the ¡separable ¡and ¡non ¡separable ¡cases ¡ Min ¡(w T w)/2 ¡ ¡ For ¡all ¡ ¡x i ¡in ¡class ¡+ ¡1 ¡ For ¡all ¡ ¡x ¡in ¡class ¡+ ¡1 ¡ ¡ w T x+b ¡ ≥ ¡1-­‑ ¡ ε i ¡ ¡ w T x+b ¡ ≥ ¡1 ¡ For ¡all ¡ ¡x i ¡in ¡class ¡-­‑ ¡1 ¡ For ¡all ¡ ¡x ¡in ¡class ¡-­‑ ¡1 ¡ ¡ w T x+b ¡ ≤ ¡-­‑1+ ¡ ε i ¡ ¡ w T x+b ¡ ≤ ¡-­‑1 ¡ For ¡all ¡i ¡ ¡ ε I ¡ ≥ ¡0 ¡ • ¡Instead ¡of ¡solving ¡these ¡QPs ¡directly ¡we ¡will ¡solve ¡ ¡a ¡dual ¡ formulaKon ¡of ¡the ¡SVM ¡opKmizaKon ¡problem ¡ • ¡The ¡main ¡reason ¡for ¡switching ¡to ¡this ¡type ¡of ¡representaKon ¡is ¡that ¡ it ¡would ¡allow ¡us ¡to ¡use ¡a ¡neat ¡trick ¡that ¡will ¡make ¡our ¡lives ¡easier ¡ (and ¡the ¡run ¡Kme ¡faster) ¡ 5 ¡

  6. An ¡alterna>ve ¡(dual) ¡representa>on ¡of ¡the ¡SVM ¡ QP ¡ Min ¡(w T w)/2 ¡ ¡ For ¡all ¡ ¡x ¡in ¡class ¡+1 ¡ • ¡We ¡will ¡start ¡with ¡the ¡linearly ¡separable ¡case ¡ w T x+b ¡ ≥ ¡1 ¡ • ¡Instead ¡of ¡encoding ¡the ¡correct ¡classificaKon ¡rule ¡and ¡ constraint ¡we ¡will ¡use ¡Lagrange ¡mulKpliers ¡to ¡encode ¡it ¡as ¡ For ¡all ¡ ¡x ¡in ¡class ¡-­‑1 ¡ part ¡of ¡our ¡minimizaKon ¡problem ¡ w T x+b ¡ ≤ ¡-­‑1 ¡ ⇓ ¡ Why? ¡ Min ¡(w T w)/2 ¡ (w T x i +b)y i ¡ ≥ ¡1 ¡ 6 ¡

  7. An ¡alterna>ve ¡(dual) ¡representa>on ¡of ¡the ¡SVM ¡ QP ¡ Min ¡(w T w)/2 ¡ (w T x i +b)y i ¡ ≥ ¡1 ¡ • ¡We ¡will ¡start ¡with ¡the ¡linearly ¡separable ¡case ¡ • ¡Instead ¡of ¡encoding ¡the ¡correct ¡classificaKon ¡rule ¡a ¡constraint ¡ we ¡will ¡use ¡Lagrange ¡mulKpliers ¡to ¡encode ¡it ¡as ¡part ¡of ¡our ¡ minimizaKon ¡problem ¡ Recall ¡that ¡Lagrange ¡mulKpliers ¡can ¡be ¡ applied ¡to ¡turn ¡the ¡following ¡problem: ¡ min x ¡x 2 ¡ s.t. ¡x ¡ ≥ ¡b ¡ Allowed ¡min ¡ To ¡ min x ¡max α ¡ x 2 ¡ -­‑ α (x-­‑b) ¡ Global ¡min ¡ b ¡ s.t. ¡ α ¡ ≥ ¡0 ¡ 7 ¡

  8. Lagrange ¡mul>plier ¡for ¡SVMs ¡ Dual ¡formulaKon ¡ ¡ Original ¡(primal) ¡formulaKon ¡ Min ¡(w T w)/2 ¡ (w T x i +b)y i ¡ ≥ ¡1 ¡ w: ¡primal ¡parameters ¡ α i ’s: ¡dual ¡parameters ¡ 8 ¡

  9. Lagrange ¡mul>plier ¡for ¡SVMs ¡ Dual ¡formulaKon ¡ ¡ Original ¡(primal) ¡formulaKon ¡ Min ¡(w T w)/2 ¡ (w T x i +b)y i ¡ ≥ ¡1 ¡ Using ¡this ¡new ¡formulaKon ¡we ¡can ¡derive ¡w ¡and ¡b ¡by ¡ taking ¡the ¡derivaKve ¡w.r.t. ¡w ¡ ¡leading ¡to: ¡ ∑ w = α i x i y i , where α i ≥ 0 i taking ¡the ¡derivaKve ¡w.r.t. ¡b ¡we ¡get: ¡ 9 ¡

  10. Lagrange ¡mul>plier ¡for ¡SVMs ¡ Dual ¡formulaKon ¡ ¡ Original ¡(primal) ¡formulaKon ¡ Min ¡(w T w)/2 ¡ (w T x i +b)y i ¡ ≥ ¡1 ¡ SubsKtuKng ¡w ¡into ¡our ¡target ¡ funcKon ¡and ¡using ¡the ¡ Using ¡this ¡new ¡formulaKon ¡we ¡can ¡derive ¡w ¡and ¡b ¡by ¡ taking ¡the ¡derivaKve ¡w.r.t. ¡w ¡ ¡leading ¡to: ¡ addiKonal ¡constraint ¡we ¡get: ¡ ∑ Dual ¡formulaKon ¡ ¡ w = α i x i y i , where α i ≥ 0 i 1 ∑ ∑ T x j max α α i α j y i y j x i α i − 2 i i,j taking ¡the ¡derivaKve ¡w.r.t. ¡b ¡we ¡get: ¡ ∑ α i y i = 0 i α i ≥ 0 ∀ i 10 ¡

  11. Dual ¡SVM ¡-­‑ ¡interpreta>on ¡ Support ¡ vectors ¡ For ¡ α ’s ¡that ¡are ¡not ¡0 ¡ 11 ¡

  12. Computa>onal ¡Cost ¡ • During ¡training, ¡the ¡computaKonal ¡costs ¡for ¡solving ¡primal ¡vs. ¡ dual ¡problems ¡are ¡ Primal ¡problem: ¡ Dual ¡problem: ¡ 1 min ¡(w T w)/2 ¡ ∑ ∑ T x j max α α i α j y i y j x i α i − 2 i i,j (w T x i +b)y i ¡ ≥ ¡1 ¡ ∑ α i y i = 0 Dot ¡product ¡for ¡all ¡ training ¡samples ¡ ¡ i α i ≥ 0 ∀ i m ¡ parameters ¡ n ¡ parameters ¡ -­‑ ¡The ¡cost ¡of ¡QP ¡solver ¡depends ¡on ¡#variables ¡ -­‑ ¡Ojen, ¡n ¡< ¡m, ¡where ¡n ¡= ¡#samples, ¡m ¡= ¡#input ¡features ¡ ¡ -­‑>Solving ¡dual ¡is ¡ojen ¡more ¡efficient ¡ -­‑ ¡Even ¡when ¡n ¡> ¡m, ¡working ¡with ¡dual ¡allows ¡you ¡to ¡use ¡kernels! ¡ 12 ¡

  13. Computa>onal ¡Cost ¡ • During ¡tesKng, ¡the ¡computaKonal ¡costs ¡using ¡primal ¡vs. ¡dual ¡ representaKons ¡are ¡ Dot ¡product ¡with ¡all ¡ training ¡samples? ¡ ¡ Using ¡primal ¡variables: ¡ Using ¡dual ¡variables: ¡ y new = sign(w T x new + b ) ∑ T x new + b ) y new = sign ( α i y i x i i m ¡operaKon ¡ mr ¡operaKons ¡where ¡ r ¡is ¡ the ¡number ¡of ¡support ¡ vectors ¡( α i >0) ¡ ¡ If ¡one ¡uses ¡dual ¡parameters ¡to ¡make ¡predicKons, ¡the ¡predicKon ¡depends ¡ only ¡on ¡the ¡support ¡vectors, ¡but ¡this ¡is ¡not ¡explicitly ¡represented ¡in ¡the ¡ primal ¡ ¡ 13 ¡

  14. Dual ¡formula>on ¡for ¡non ¡linearly ¡separable ¡ case ¡ For ¡all ¡ ¡x i ¡in ¡class ¡+ ¡1 ¡ ¡ w T x+b ¡ ≥ ¡1-­‑ ¡ ε i ¡ (w T x i +b)y i ¡ ≥ ¡1-­‑ ¡ ε I ¡ ⇓ ¡ For ¡all ¡ ¡x i ¡in ¡class ¡-­‑ ¡1 ¡ ε I ¡ ≥ ¡0 ¡ ¡ w T x+b ¡ ≤ ¡-­‑1+ ¡ ε i ¡ For ¡all ¡i ¡ ¡ ε I ¡ ≥ ¡0 ¡ 14 ¡

  15. Dual ¡formula>on ¡for ¡non ¡linearly ¡separable ¡ case ¡ Dual ¡target ¡funcKon: ¡ To ¡evaluate ¡a ¡new ¡sample ¡x j ¡we ¡ need ¡to ¡compute: ¡ The ¡only ¡difference ¡is ¡that ¡ the ¡ α I ’s ¡are ¡now ¡bounded ¡ ¡ 15 ¡

  16. Dual ¡SVM ¡– ¡Interpreta>on ¡for ¡Non-­‑linearly ¡ Separable ¡Case ¡ Support ¡vectors: ¡data ¡ points ¡in ¡the ¡wrong ¡side ¡ of ¡margin ¡ +1 ¡ -­‑1 ¡ For ¡ α ’s ¡that ¡are ¡not ¡0 ¡ 16 ¡

  17. Error ¡Func>on ¡for ¡SVM ¡ t ¡> ¡0 ¡for ¡both ¡posiKve ¡ and ¡negaKve ¡training ¡ samples ¡if ¡classified ¡ correctly ¡ Let ¡t ¡= ¡(w T x i +b)y i ¡ ¡ Error(t) ¡ Ideal ¡classifier: ¡ ¡ ¡ ¡ 0 ¡ ¡ if ¡t ¡ > ¡0 ¡ Error(t) ¡= ¡ ¡ 1 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡1 ¡ ¡ if ¡t ¡ < ¡0 ¡ ¡ ¡ SVM ¡ t ¡ 0 ¡ 1 ¡ ¡ ¡ ¡Error(t) ¡= ¡[1-­‑ ¡t] + ¡ ¡ [ ¡] + ¡denotes ¡ posiKve ¡part ¡ Hinge ¡Loss ¡ 17 ¡

  18. FROM ¡LINEAR ¡TO ¡NON-­‑LINEAR ¡ DECISION ¡BOUNDARY ¡ 18 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend