Download Support Vector Machines: Maximizing the Margin with SVMs - Prof. Ching Cheung and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!
Multimedia Information Systems
Samson Cheung^ EE 639, Fall 2004
Lecture 17: Support Vector Machine (based on Professor R. Mooney’s original slides)
Topic Outline ^ SVM belongs to a class of methods called thekernel methods. ^ SVM come out of two basic ideas:^
Optimal-margin classifier Kernel “trick”
Linear Separators ^ Which of the linear separators is optimal?
Classification Margin Distance from example to the separator is Examples closest to the hyperplane are
support vectors
^ Margin
ρ^ of the separator is the width of separation between
classes.
xw b w r
T^ +=
r
Linear SVM Mathematically ^ Fix the scale such that data points closest to theseparator satisfy
T |wx+b|=
. Given a training set
{(x,i^
y )}^ , we have i
^ For support vectors, the inequality becomes anequality; then, since each example’s distance fromthe hyperplane is
the margin is:
T wx
+^ b i
≥^1
if^ y = 1 i^
T wx
+^ b i
≤^ -^1
if^ y
= -1 i
(^2) = ρ w
xw b w r
T^ +=
Linear SVMs Mathematically ^ Then we can formulate the
quadratic optimization
problem: A better formulation:
Find
w^ and
b^ such thatis maximized and for all
{( x
, y )} i i
T wx
+^ b i
≥^ 1 if
y =1; i
T w
x +^ i^
b^ ≤^ -
1 if
y = -1 i^
Find
w^ and
b^ such thatis maximized and for all
{( x
, y )} i i
T wx
+^ b i
≥^ 1 if
y =1; i
T w
x +^ i^
b^ ≤^ -
1 if
y = -1 i^
(^2) = ρ w
Find
w^ and
b^ such that
Φ( w
)^ =½ w
T w^
is minimized and for all
{( x
, y )} i i
y ( w i^
Tx + i^
b )^ ≥
Find
w^ and
b^ such that
Φ( w
)^ =½ w
T w^
is minimized and for all
{( x
, y )} i i
y ( w i^
Tx + i^
b )^ ≥
The Optimization ProblemSolution ^ The solution has the form: ^ Each non-zero
α indicates that corresponding i^
x is a support i^
vector. Then the classifying function will have the form: Notice that it relies on an
inner product
between the test point
x
and the support vectors
x – we will return to this later! i^
^ Also keep in mind that solving the optimization problem involvedcomputing the inner products
T xx between all training points! ij^
w = Σ
α y x ii i
b =^ yk
T - wx for any k
x such that k^
α^ ≠^0 k
w = Σ
α y x ii i
b =^ yk
T - wx for any k
x such that k^
α^ ≠^0 k
f ( x ) =
Σα yi
Txx + i i b
f ( x ) =
Σα yi
Txx + i i b
Soft Margin Classification ^ What if the training set is not linearly separable? ^ Slack variables
ξ can be added to allow i^
misclassification of difficult or noisy examples.
ξ i ξ i
Soft Margin Classification –Solution ^ The dual problem for soft margin classification: ^ Neither slack variables
ξ nor their Lagrange multipliers i^
appear in the dual problem! Again,
x with non-zero i^
α will be support vectors. i^
^ Solution to the dual problem is:
Find^
α … α^1
such that N
Q (α)
-^ ½ ΣΣ i
αα yiji
T y xx j i is maximized and j
(1)^ Σ
α y = 0 ii^ (2) 0
≤^ α≤ i^
C^ for all
α i
Find^
α … α^1
such that N
Q (α)
-^ ½ ΣΣ i
αα yiji
T y xx j i is maximized and j
(1)^ Σ
α y = 0 ii^ (2) 0
≤^ α≤ i^
C^ for all
α i
w = Σ
α y x ii i b= yk
(1-^ ξ k
T ) - w x where k = argmax k^
α k
w = Σ
α y x ii i b= yk
(1-^ ξ k
T ) - w x where k = argmax k^
α k k^
f ( x ) =
Σα yi
Txx + i i b
f ( x ) =
Σα yi
Txx + i i b
But neither
w^ nor
b^ are
needed explicitly forclassification!
Brief detour of statistical learning theory ^ Given training data {x
,y}, find f from a class ofii
functions to minimize^ ^ Empirical risk: A very complex function f may drive R
(f) to zeroemp
but may not generalize well to other data. In otherwords, the risk may be high:^ ^ Risk:^ ^ Overfitting error^ ^ But in general, we don’t know R(f) cause we don’t knowp(x,y)
∑=
m i
i i
emp^
y
xf
m
f
R^
1
), ( )( )(
1 2
yx dpy xf fR
∫^
−
To characterize complexity: VC Dimension Focus on binary classificationwhere f(x) is bindary h = VC dimension= largest possible # of data points “shattered”by a function class ^ Vapnik : for
m^ data points, with prob > 1-
δ^
^
^
4 ln δ
2 ln
m h
hm
f
R
fR
emp
?
VC dimension of theset of oriented lines^2 in R
is 3
Theoretical Justification forMaximum Margins ^ Vapnik has proved the following:^ The class of optimal linear separators has VC dimension hbounded from above aswhere
ρ^ is the margin, D is the diameter of the smallest sphere that can enclose all of the training examples, and m
is the 0
dimensionality. Intuitively, this implies that regardless of dimensionality
m we^0
can minimize the VC dimension by maximizing the margin
ρ.
^ Thus, complexity of the classifier is kept small regardless ofdimensionality.
1 , min^
2 ^ +^ ^02
≤^
Dm h
ρ
Non-linear SVMs ^ Datasets that are linearly separable with some noise workout great: ^ But what are we going to do if the dataset is just too hard? ^ How about… mapping data to a higher-dimensional space:
(^2) x
x
0
x
0
x
Non-linear SVMs: Feature spaces ^ General idea:
the original feature space can always
be mapped to some higher-dimensional feature spacewhere the training set is separable:
Φ:^ x →^ φ ( x )