Mchne Lernng Support Vector Mchnes SVM Lesson 6
Dt Clssfcton problem rnng set:, D,,, : nput dt smple {,, K}: clss or lbel of nput rget: Construct functon f : X Y f, D Predcton of clss for n unknon nput * f * Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( )
erest eghbor clssfer he smplest clssfcton method Assumpton: dt belongs to the sme ctegor re neghbors Clssfcton rule: Clssf ccordng to the neghbor(s) Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 3 )
Clssfcton erest eghbor Clssfer Fnd the nerest neghbor (ccordng to dstnce functon) m m n,, : mn dst, * n * Clss of unknon s smlr to ts neghbor * m Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 4 )
Fnd k> neghbors Etenson to k- Clssf ccordng to the clss mort Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 5 )
Vorono dgrm Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 6 )
Lner Clssfers Κ= clsses Ω, Ω rget: Constructon of hperplne f(,) beteen dt of clsses Decson boundres: f f else f f, then, then re the unknon prmeters Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 7 )
lner clssfcton nonlner clssfcton Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 8 )
rnng Set D, + > f() lner functon: f Defne seprtng hperplne beteen to clsses + < Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 9 )
Queston: Whch s the optmum hperplne tht seprtes better to clsses? Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( )
Queston: Whch s the optmum hperplne tht seprtes better to clsses? Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( )
Queston: Whch s the optmum hperplne tht seprtes better to clsses? Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( )
Queston: Whch s the optmum hperplne tht seprtes better to clsses? Infnte number of solutons! Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 3 )
Soluton: Mrgnl Mmzton [Boser, Guon, Vpnk 9], [Cortes & Vpnk 95] he optml seprtng hperplne s the one tht gves the mmum mrgn dth Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 4 )
Mrgnl Mmzton Defnton : Mrgn s the mnmum dstnce of trnng smples to the hperplne mn dstnce Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 5 )
Mrgnl Mmzton Defnton : Mrgn s the mnmum dstnce of trnng smples to the hperplne m dth Defnton : Mrgn s the mmum dth of boundr round the seprtng hperplne thout coverng n smple Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 6 )
Mrgnl Mmzton Defnton : Mrgn s the mnmum dstnce of trnng smples to the hperplne Mrgn Defnton : Mrgn s the mmum dth of boundr round the seprtng hperplne thout coverng n smple Wh s the optmum soluton? Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 7 )
Mrgnl Mmzton Soluton: Fnd the hperplne tht mmzes the mrgn beteen to clsses. sfe zone Mrgn hs ll mnmze the rsk of clssfer s decson. Also, t ll ncrese the generlzton of clssfer (Vpnck, 963) Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 8 )
Dstnce of n pont Mrgn: r( ) + = r mn mn mrgn Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 9 )
Mrgnl Mmzton Problem mn, ˆ, ˆ : m Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( )
Mrgnl Mmzton Problem mn, ˆ, ˆ : m Soluton: Use sclng fctor k: k mn Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( )
Mrgnl Mmzton Problem mn, ˆ, ˆ : m Soluton: Use sclng fctor k: k mn hus mrgn becomes: mn Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( )
herefore: D: Mrgn + + - Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 3 )
he obectve functon We need to optmze hch s the sme s mnmzng subect to the mrgn requrements ˆ, ˆ : m, s.t. ˆ, ˆ : mn, s.t. Qudrtc Optmzton Problem: mnmze qudrtc functon subect to set of lner neqult constrnts Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 4 )
SVM rnng Methodolog rnng s formulted s n optmzton problem Dul problem reduces computtonl complet Kernel trck s used to reduce computton Determnton of the model prmeters corresponds to conve optmzton problem. Soluton s strghtforrd (locl soluton s the globl optmum) Mkes use of Lgrnge multplers Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 5 )
Joseph-Lous Lgrnge (736-83) Optmzton problem th lner neqult constrnts mn Lgrnge functon: f s.t. g c g c L, f g Krush-Khun-ucker (KK) condtons: g c g c c Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 6 )
Mnmzton Problem: Lgrnge functon: Solvng the Optmzton Problem s.t. mn : ˆ, ˆ, L,, KK condtons Lgrnge multplers Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 7 )
Dul Optmzton Problem L ˆ L L,, mnmze Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 8 )
Prme problem L,, mnmze Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 9 )
Prme problem L,, mnmze ˆ Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 3 )
s.t. Prme problem Dul problem L,, mnmze ˆ D L mmze, Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 3 )
Importnt Remrks. he Prme problem hs d+ unknon prmeters tht must be tuned. hese re the lner coeffcents {, }, here d s the dt dmenson. he Dul problem hs unknon prmeters hch re the Lgrnge multplers { =,, }, here s the number of trnng smples. hs s vluble nd convenent for mult-dmensonl dt, here d>>, snce the dul serch spce s sgnfcntl loer n comprson th the prme serch spce. Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 3 )
. he decson rule for choosng the clss of n unknon smple becomes: hch s lner combnton of dot products of th ll trnng smples, here ech one hs unque eght equl to the Lngrnge multpler. ˆ f f Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 33 )
3. Accordng to the KK condtons e hve: hus: or nd nd Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 34 )
3. Accordng to the KK condtons e hve: hus: or rnng smples of D th zero eght outsde the mrgn Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 35 )
3. Accordng to the KK condtons e hve: hus: or rnng smples of D hch re found on the mrgn Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 36 )
All trnng smples outsde the mrgn hve = nd the do not pl n sgnfcnt role to the decson. rnng smples over the mrgn hold: + - + Mrgn nd the hve >. hese re clled support vectors nd the pl mportnt role to the decson. Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 37 )
An emple. Clss (+) 5 = 8 =.6 = 7 = = Support vectors th no-zero vlues ho support the mrgn 4 = 6 =.4 =.8 9 = Clss (-) 3 = Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 38 )
4. Kernel trck: Use prtculr representton φ() Ide: he orgnl feture spce s trnsformed nto (usull) lrger feture spce hch ncreses the lkelhood of beng lner seprble. Φ: φ() Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 39 )
In the ne spce ll dot products become: hch s clled kernel functon nd specfes smlrt he ne decson rule cn be rtten s: K,, K f f f Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 4 )
Emples of kernel functons Lner Kernel Polnoml Kernel Gussn ή RBF Kernel Cosne Sgmod... K K, p K K K,, e,, e Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 4 )
Emple : Construct lner feture spce usng φ() Input Spce Orgnl spce (.) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) Kernel spce rnsformed spce Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 4 )
Emple o o o o ( ) ( o) ( o) ( ) ( o) ( ) ( ) ( o) X F Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 43 )
5. Estmte the constnt term Set of support vectors Substtutng e tke: Summng ll: : S ˆ S S S K s S S, sze of S Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 44 )
Applctons Bonformtcs et ctegorzton mnng Hndrtten chrcter recognton Computer Vson me seres nlss.. Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 45 )
Bonformtcs gene epresson dt Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 46 )
et ctegorzton mnng Bg of ords (lecon) Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 47 )
onlner SVM he non-seprble cse Mppng dt to hgh dmensonl spce, v φ(), ncrese the lkelhood the dt be seprble. Hoever, ths cnnot be gurnteed. Also, seprtng hperplne mght be susceptble to outlers. Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 48 )
onlner SVM he non-seprble cse eed to mke the lgorthm ork for nonlnerl seprble cses, s ell s to be less senstve to outlers. Introducton of ulr vrbles ξ hch llo errors,.e. smples beng n erroneous sde of mrgn. Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 49 )
For n smple : f Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 5 )
For n smple : f If found n the rght sde (no error), then ξ =. Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 5 )
For n smple : f If found n the rght sde (no error), then ξ =. If found nsde the mrgn but n the rght sde ξ < Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 5 )
For n smple : f If found n the rght sde (no error), then ξ =. If found nsde the mrgn but n the rght sde ξ < If found ectl n the hperplne here + = then ξ = Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 53 )
For n smple : f If found n the rght sde (no error), then ξ =. If found nsde the mrgn but n the rght sde ξ < If found ectl n the hperplne here + = then ξ = If t s rong clssfed then ξ > Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 54 )
We llo mrgn be less thn ξ pls to role of error tolernce for ever smple nd sets up the locl mrgn hch llos mrgn to enter the spce of other clss. Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 55 )
onlner SVM Obectve functon: s the totl error tolernce of trnng set Problem: s.t. mn,, C Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 56 )
Problem: C L,, C,, mn Lgrnge functon s.t. onlner SVM Lgrnge multplers ( ) Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 57 )
ΚΚΤ condtons or or C L,, mnmze he dul form of the problem Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 58 )
he dul form of the problem C L,, mnmze L ˆ L C L Prtl dervtves Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 59 )
D L mmze, C s.t. Dul form of the problem C L,, mnmze he dul form of the problem Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 6 )
D L mmze, C s.t. If > then re support vectors: If < C then μ > nd ξ =. It holds: he dul form of the problem Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 6 )
he dul form of the problem mmze L D s.t. C, If = C then μ = nd ξ >. Smple s nsde the mrgn If ξ then s rght clssfed, If ξ > then s rong clssfed Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 6 )
he dul form of the problem mmze LD s.t. C, If = C then μ = nd ξ >. Smple s nsde the mrgn If ξ then s rght clssfed, If ξ > then s rong clssfed Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 63 )
he SMO lgorthm J. Pltt, Fst rnng of Support Vector Mchnes usng Sequentl Mnml Optmzton, MI Press (998). Sequentl Mnml Optmzton (SMO) Solvng the dul problem mmze L D s.t. C, Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 64 )
SMO lgorthmc structure SMO breks ths problem nto seres of smllest possble sub-problems, hch re then solved sequentll. he smllest problem nvolves to such multplers : hs reduced problem cn be solved nltcll: C 3 nd, m : ˆ D L ˆ f ˆ f ˆ ˆ f ) ( C C C ne ˆ ˆ Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 65 )
Emples of non-lner svm clssfcton Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 66 )
Mult-clss Clssfcton Workng th more thn clsses o generl schemes one vs. ll clssfers Prse Clssfers Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 67 )
One vs. All Clssfers One clssfer for ever clss =,,K Smples of emned clss re postve (lbel +), hle rest smples from ll other K- clsses re negtve emples th lbel -. rnng the K dfferent clssfers nd construct functons: f Decson rule: Clssf n unknon smple to the clss th the mmum functon vlue: d c rg m,..., K f Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 68 )
Prse Clssfers One clssfer for ever pr of clsses (, k) rnng the K*(Κ-) clssfers nd construct seprtng functons for ever pr: f k, k, k Decson rule: Clssf n unknon smple to the clss th the most votes mong ll clssfers. In cse of equvlence use the functons vlues for tkng the decson. d Mchne Lernng 7 Computer Scence & Engneerng, Unverst of Ionnn ML6 ( 69 )