Basic Concept of SVM
Basic Concept of SVM
o Which line
will classify
the unseen
data well?
o The dotted
line! Its line
with
Maximum
(C) CDAC Mumbai Workshop on Machine Learning
Margin!
Cont…
− 1
W T X + b = 0
+ 1
o Geometric Margin:
w.r.t W T (i)
b
1)Individual examples: γ (i)
= y (i)
x +
|| W || || W ||
2) example set S,
( i )
γ = min γ
i = 1 ,..., m
− 1
W T
X + b = 0
+ 1
(C) CDAC Mumbai Workshop on Machine Learning
Cont..
o Distance of a point (u, v) from Ax+By+C=0, is given by
|Ax+By+C|/||n||
Where ||n|| is norm of vector n(A,B)
b
o Distance of hyperpalne from origin =
|| W ||
b + 1
o Distance of point A from origin = || W ||
b −1
o Distance of point B from Origin = || W ||
2
o Distance between points A and B (Margin) =
|| W ||
Such that
T 2
Notice:W W =|| W ||
Such that
m
1
[ ]
L (W , b , α ) = || W || 2 − ∑ α i Y ( i ) (W T X ( i ) + b ) − 1
2 i =1
i.e.
m
W = ∑ α iY ( i ) X ( i )
i =1
∑
i =1
α iY (i)
= 0
s .t .
α i ≥ 0, i = 1 ,..., m
m
∑i =1
α iY (i)
= 0
s .t .
α i ≥ 0, i = 1,..., m
m
∑α Y
i =1
i
(C) CDAC Mumbai
(i )
= 0 Workshop on Machine Learning
Kernel function:
o There exist a way to compute inner product in feature
space as function of original input points – Its kernel
function!
o Kernel function:
K(x, z) = φ(x),φ(z)
o We need not know φ to compute K ( x , z )
i , j =1
K ( x, z ) = φ ( x),φ ( z )
(C) CDAC Mumbai Workshop on Machine Learning
example cont…
o Here,
for x1 x1 1
x 1 x 2 2
φ (x) = =
K ( x, z) = ( xT z)2 x 2 x1 2
x2x2 4
1 3
x = z = 9
12
2 4 φ (z) =
12
3
xT z = [1 2 ] 16
4 9
12
= 11 φ ( x ) T φ ( z ) = [1 2 2 4 ]
12
K ( x , z ) = ( x T z ) 2 = 121 16
= 121
s .t .
α i ≥ 0, i = 1,..., m
m
∑α Y
i =1
i
(i)
=0
o Decision function
m
F ( X ) = Sign(∑ α iY (i ) K ( X (i ) , X ) + b)
i =1
o Linear: K ( X ,Y ) = X TY
o Polynomial of degree d: K ( X , Y ) = ( X T Y + 1) d
|| X −Y ||2
−
Gaussian Radial Basis Function (RBF): 2σ 2
o K ( X ,Y ) = e
[email protected] ;
[email protected]