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

support vector machines
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Support ¡Vector ¡Machines ¡

COMP ¡640 ¡ Ryan ¡Spring, ¡Sarah ¡Kim ¡

slide-2
SLIDE 2

Quiz ¡Example ¡SoluBons ¡

slide-3
SLIDE 3

What ¡is ¡classificaBon? ¡

F(x) ¡= ¡-­‑1 ¡Not ¡Spam ¡ F(x) ¡= ¡+1 ¡Spam ¡

slide-4
SLIDE 4

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

slide-5
SLIDE 5

Linear ¡Classifier ¡

Y = F(wTx) = wix j

slide-6
SLIDE 6

MulBple ¡Possible ¡SoluBons ¡

slide-7
SLIDE 7

Defining ¡Features ¡of ¡SVM ¡

slide-8
SLIDE 8

How ¡SVM ¡works ¡

w

slide-9
SLIDE 9

Unknown ¡Data ¡(1) ¡

u w

slide-10
SLIDE 10

Unknown ¡Data ¡(2) ¡

u w U*w ¡ ProjecBon ¡of ¡unknown ¡item ¡ u ¡onto ¡vector ¡w ¡that ¡is ¡ perpendicular ¡to ¡the ¡ hyperplane ¡

slide-11
SLIDE 11

SVM ¡Decision ¡Rule ¡

u w U*w ¡ ​𝑥 ∙​𝑣 +𝑐≥0 ¡then ¡​X↓+ ¡ ​𝑥 ∙​𝑣 +𝑐<0 ¡then ¡​X↓− ¡

slide-12
SLIDE 12

Learning ¡SVM-­‑Minimizing ¡w ¡

​𝑦↓+ −​𝑦↓− ¡ 𝑋𝑗𝑒𝑢ℎ=(​𝑦↓+ −​𝑦↓− )∙​𝑥/‖𝑥‖ ¡ ​𝑧↓𝑗 (​𝑦↓𝑗 ​𝑥 +𝑐)−1=0 ¡ Constraints: ¡ ​𝑥/‖𝑥‖ ¡

slide-13
SLIDE 13

Learning ¡SVM-­‑Minimizing ¡w ¡

​𝑦↓+ −​𝑦↓− ¡ 𝑋𝑗𝑒𝑢ℎ=(​𝑦↓+ −​𝑦↓− )∙​𝑥/‖𝑥‖ ¡ ​𝑧↓𝑗 (​𝑦↓𝑗 ​𝑥 +𝑐)−1=0 ¡ Constraints: ¡ 1−𝑐 ¡ 1+𝑐 ¡ ​𝑥/‖𝑥‖ ¡

slide-14
SLIDE 14

Learning ¡SVM-­‑Minimizing ¡w ¡

​𝑦↓+ −​𝑦↓− ¡ 𝑋𝑗𝑒𝑢ℎ=(​𝑦↓+ −​𝑦↓− )∙​𝑥/‖𝑥‖ =​2/‖𝑥‖ ¡ ​𝑧↓𝑗 (​𝑦↓𝑗 ​𝑥 +𝑐)−1=0 ¡ Constraints: ¡ 1−𝑐 ¡ 1+𝑐 ¡ ​𝑥/‖𝑥‖ ¡

slide-15
SLIDE 15

Learning ¡SVM ¡– ¡Minimizing ¡w ¡

p(w,b) =

{x:y=1}

min

x⋅w | w | −

{x:y=−1}

max

x⋅w | w |

p(w0,b0) = 2 | w0 | = 2 w0 ⋅w0

Distance ¡between ¡projecBons ¡of ¡training ¡data: ¡ When ¡maximizing ¡this ¡distance: ¡ Minimize ¡this ¡

slide-16
SLIDE 16

Learning ¡SVM ¡– ¡Penalizing ¡ misclassificaBon ¡

¡

Hinge ¡Loss ¡FuncBon ¡

C max(0,1− yi f (xi))

i N

slide-17
SLIDE 17

Primal ¡Form ¡

min

w∈ℜd || w ||2 +C

max(0,1− yi

i N

f (xi))

w ∈ ℜd For ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡ ¡

f (x) = wTx + b

Penalizing ¡misclassificaBon ¡ (Hinge ¡Loss) ¡

Minimize ¡w ¡ Maximize ¡margin ¡ ß ¡Classifier ¡

slide-18
SLIDE 18

Challenges ¡

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

¡

slide-19
SLIDE 19
  • 1. ¡Handling ¡Error ¡-­‑ ¡Slack ¡Variables ¡

ξi ≥ 0

0 < ξ ≤1

ξ >1

Inside ¡the ¡margin ¡ Misclassified ¡

X ¡ X ¡

All ¡data ¡points ¡

slide-20
SLIDE 20

Slack ¡FormulaBon ¡

min

w∈ℜ,ξi∈ℜ+ || w ||2 +C

ξi

i N

Subject ¡to ¡ ¡

yi(wTxi + b) ≥1−ξi

For ¡i ¡= ¡1…N ¡

slide-21
SLIDE 21
  • 2. ¡Non-­‑Linear ¡SeparaBon ¡-­‑ ¡Dual ¡Form ¡

f (x) = α jyjx j

j=1 N

" # $ $ % & ' '

T

x + b = αi

i N

yi(xi

Tx)+ b

SoluBon ¡w ¡can ¡be ¡wriaen ¡as ¡linear ¡combo ¡of ¡training ¡data: ¡

w = ajyjx j

j=1 N

SubsBtute ¡w ¡in ¡primal ¡classifier ¡ ¡ ¡f (x) = wTx + b

slide-22
SLIDE 22

Dual ¡Form ¡Problem ¡

max

αi≥0

α i

i

− 1 2 α j

jk

αkyjyk(x j

Txk)

Subject ¡to ¡0 ¡≤ ¡α ¡≤ ¡C ¡for ¡ ¡ ¡ ¡ ¡, ¡and ¡ ¡ For ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡ ¡ ¡ w ∈ ℜN

∀i

αiyi

i

= 0

slide-23
SLIDE 23

Kernel ¡Trick ¡

Dual ¡Form ¡Classifier: ¡ ¡ ¡ Kernel ¡Classifier: ¡ ¡ Knowledge ¡of ¡inner ¡product ¡is ¡key ¡

f (x) = αi

i N

yi(xi

Tx)+ b

f (x) = αi

i N

yik(xi , x)+ b

k(xi,x) = (xi

Tz)

slide-24
SLIDE 24

Example: ¡Polynomial ¡Kernel ¡

k(x, x') = (1+ xTx')2

  • ­‑ ¡
  • ­‑ ¡
  • ­‑ ¡
  • ­‑ ¡ -­‑ ¡

+ ¡ + ¡ + ¡ + ¡ + ¡ + ¡

slide-25
SLIDE 25

Experiments ¡-­‑ ¡Classifying ¡Numbers ¡

¡

  • Postal ¡(16x16 ¡pxls): ¡7,300 ¡training, ¡2,000 ¡test ¡ ¡
  • NIST ¡(28x28 ¡pxls): ¡60,000 ¡training, ¡10,000 ¡test ¡
slide-26
SLIDE 26

Error ¡remains ¡constant ¡with ¡ increasing ¡feature ¡space ¡size ¡

Training ¡ Bme? ¡

slide-27
SLIDE 27

Comparison ¡with ¡other ¡classifiers ¡

slide-28
SLIDE 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 ¡

slide-29
SLIDE 29

Conclusions ¡about ¡SVM ¡

  • OpBmal ¡hyperplane ¡for ¡classificaBon ¡

¡

  • Universal ¡learning ¡machine ¡

– Slack ¡variables ¡(error) ¡ – Kernels ¡(non-­‑linear ¡separaBon) ¡ ¡

  • Knowledge ¡of ¡inner ¡products ¡is ¡key ¡

¡

slide-30
SLIDE 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 ¡