1 / 18

Konsep Support Vector Machine

Konsep Support Vector Machine. Lecture 1. Hard Margin SVM Lagrange Multiplier Dual Problem Gradient Ascent/Descent. (update 21 Agustus 2009 ). Model linear classifier. Andaikan diberikan data training yang linearly separable menjadi dua kelas , yaitu A dan B.

jill
Télécharger la présentation

Konsep Support Vector Machine

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Konsep Support Vector Machine Lecture 1 • Hard Margin SVM • Lagrange Multiplier • Dual Problem • Gradient Ascent/Descent (update 21 Agustus 2009)

  2. Model linear classifier Andaikandiberikan data training yang linearly separable menjadiduakelas, yaitu A dan B. Terdapatbanyaksekalihyperplane yang memisahkankeduakelasdari data. Mana yang dipilih? Bagaimanamenemukanhyperplaneterbaik yang memisahkankeduahimpunandengan margin terbesar? Margin: jarakhyperplaneketitikterdekatdarikeduahimpunan Dalam 2 dimensi, hyperplane garis Dalam 3 dimensi, hyperplane  bidang

  3. Hyperplaneterbaik (2 dimensi) • Persamaanhyperplane (garis) g: w1x1+w2x2+b=0 • Agar g memisahkankelas A dan B, makadapatdipilih w1,w2dan b sehingga • w1x1(i)+w2x2(i)+b>0 utk (x1(i),x2(i)) A • w1x1(i)+w2x2(i)+b<0 utk (x1(i),x2(i)) B • Andaikan (x1+,x2+) dan (x1-,x2-) masing-masingtitikterdekatdarikelas A dan B terhadapg.Tanpamengurangikeumuman, dapatdipilih: • w1x1++w2x2++b=1 dan w1x1-+w2x2-+b=-1 • dan • w1x1(i)+w2x2(i)+b  1 utk (x1(i),x2(i)) A • w1x1(i)+w2x2(i)+b  -1 utk (x1(i),x2(i)) B

  4. Hyperplaneterbaik (2 dimensi) Makajarakgaris g ketitik (x1+,x2+) dan (x1-,x2-) adalah Definisikan: maka (w1x1(i)+w2x2(i)+b)yi 1, untuk I = 1, 2, …, N

  5. Constrained Opt. Problem • MasalahPenentuanHyperplaneterbaik: Ekivalendengan

  6. Hyperplaneterbaik (Generalisasi) • Persamaanhyperplane g: wTx+b=0 • Agar g memisahkankelas A dan B, makadapatdipilihwTdan b sehingga • wTx(i)+b>0 utk x(i) A • wTx(i)+b<0 utk x(i) B • Andaikan x+dan x-masing-masingtitikterdekatdarikelas A dan B terhadapg.Tanpamengurangikeumuman, dapatdipilih: • wTx++b =1 danwTx-+b = -1 • dan • wTx(i)+b  1 utk x(i) A • wTx(i)+b  -1 utk x(i) B

  7. Hyperplaneterbaik (generalisasi) Makajarak g ketitikx+,x+dan x-adalah Definisikan: maka (wTx(i)+b)yi 1, untuki = 1, 2, …, N

  8. Constrained Opt. Problem • MasalahPenentuanHyperplaneterbaik: Ekivalendengan

  9. Lagrange Multiplier Solusix yang memaksimumkan/ meminimumkanfungsi f(x) yang memenuhikendala g(x) = 0 diperolehdarisolusipersamaan f(x) = g(x) Contoh: Carilahnilaimaksimum/minimum untukfungsi f(x,y) = x2 +y2 yang memenuhi x-y = 1 atau 2x-  = 0 2y + = 0 x-y = 1 Titikkritisdiperolehdari 2x =  2y = - x-y = 1 Diperoleh x = ½, y=-½,  = 1

  10. Lagrange Multiplier Carinilaimaksimum/minimum f(x,y,z) = x + 2y +3z yang memenuhi x2 + y2 = 2 dan y +z = 1 g1(x,y,z) = x2 + y2 -2 =0 g2(x,y,z) = y + z – 1 = 0 Solusimasalahmaks/minimum diperolehdari: f(x,y,z) = 1g1(x,y,z) + 2g2(x,y,z)

  11. Lagrange Multiplier Solusix yang memaksimumkan/meminimumkanfungsi f(x) yang memenuhikendala g(x) = 0 diperolehdarisolusipersamaan f(x) = g(x) Versi lain: L(x, ) = f(x)+g(x) Solusimasalahmaksimum/minimum diperolehdari L(x, ) = 0 L seringdikenalsebagaiLagrangian

  12. Lagrange Multiplier (inequality constraint) Solusimasalahoptimasi (primal) Min f(x), x s.t. g(x) 0 dan h(x)=0 Feasible Domain D={x  |g(x)0, h(x)=0} Lagrangian L(x, , ) = f(x)+g(x)+ h(x) Dual Problem Max (, ) s.t.   0 (, ) = infxL(x, , ) Untuksetiaptitik feasible x, (, )  L(x, , )  f(x) Duality Gap = f(x) - (, ) Denganmemaksimumkan(, ) terhadap  dan , akanmeminimumkan duality gap. Khususnya, Jika g dan h fungsi Affine, yaitu g(x) = Ax – b ( A matriks, b vektor) maka duality gap menjadi 0. Artinya, solusi masalah primal ekivalendengansolusimasalah dual.

  13. Ilustrasi 1 Lagrangian L(x,y, ) = x2+y2+(x-y-1) Solusimasalahoptimasi (primal) Min x2+y2, s.t. x-y 1 Untuksuatunilai yang diberikan, agar L minimum 2x + = 0 2y -  = 0 Dual Problem Max () = ¼2+ ¼2+(-/2-/2-1) = -2/2 -  s.t.   0 Diperoleh=0, x = 0 dan y = 0 Iniberarti constraint tidakaktif!!!

  14. Ilustrasi 2 Lagrangian L(x,y, ) = x2+y2-(x-y-1) Solusimasalahoptimasi (primal) Min x2+y2, s.t. x-y 1 Agar L minimum 2x - = 0 2y +  = 0 Dual Problem Max (, ) = ¼2+ ¼2-(/2+/2-1) = -2/2 +  s.t.   0 Diperoleh=1, x = 1/2 dan y = -1/2 Iniberarti constraint aktif, artinyanilai minimum tercapaipadabatas constraint.

  15. Linear Classifier Prob. (2 dimensi) Nilai minimum L diperolehdari : yaitu

  16. Linear Classifier Prob. (Cont.) SubstitusikeLagrangian: diperoleh

  17. Dual Problem StudiKasus Carihyperplane classifier terbaikuntuk data training P1(1,0), P2(0,1), P3(2,2), dan Q1(-1,0), Q2(0,-1),

  18. Gradient Descent / Ascent Diketahuipermukaan z = f(x,y) dengankurvaketinggian Dinyatakanpadagambar. Berangkatdari (x0,y0), nilai f(x,y) menurun paling cepat bilabergerakdalamarah -f(x0,y0), bertambah paling cepatbilabergerakdalam arah f(x0,y0). Contoh: Bila f(x,y) = x2+y2dan (x0,y0)= (2,1), maka f(2,1) = 5. Arahgerak agar nilai f menurun paling besardititik P : (-4,-2) (x1, y1) = (x0,y0)+ (-4,-2) = (2,1) + (-4,-2) Utk = 0.1, (x1, y1) = (1.6, 0.8). Nilai f (x1, y1) = 3.2 Utk = 0.2, (x1, y1) = (1.2,0.6). Nilai f(x1, y1) = 1.8

More Related