







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








CS 540, University of Wisconsin-Madison, C. R. Dyer
-^
-^
-^
-^
Acknowledgments
:^
These slides combine and modify ones
provided by Andrew Moore (CMU), Glenn Fung (Wisconsin), andOlvi Mangasarian (Wisconsin)
CS 540, University of Wisconsin-Madison, C. R. Dyer
What are Support Vector Machines
Used For?
-^
-^
-^
CS 540, University of Wisconsin-Madison, C. R. Dyer
f
x
denotes +1denotes -
f( x ,w
,b
) = sign(
w
x
b
)
How would youclassify this data?
CS 540, University of Wisconsin-Madison, C. R. Dyer
(aka Linear Discriminant Functions)
Definition
It is a function that is a linear combination of thecomponents of the input
x
where
w
is the weight vector and
b the bias
A two-category classifier then uses the rule:Decide class
c^1
if f(
x
0 and class
c^2
if
f(
x
Decide
c^1
if w
T^ x
-b
and
c^2
T otherwise
1
( )
m
ij^
j
j
f^
x^
w x
b^
b
= =^
+^
=
∑
w x
CS 540, University of Wisconsin-Madison, C. R. Dyer
f
x
denotes +1denotes -
f( x ,w
,b
) = sign(
w
x
b
)
How would youclassify this data?
CS 540, University of Wisconsin-Madison, C. R. Dyer
f
x
denotes +1denotes -
f(
x,
w
,b
) = sign(
w
x
b
)
How would youclassify this data?
CS 540, University of Wisconsin-Madison, C. R. Dyer
f
x
denotes +1denotes -
f( x ,w
,b
) = sign(
w
x
b
)
How would youclassify this data?
CS 540, University of Wisconsin-Madison, C. R. Dyer
f
x
denotes +1denotes -
f(
x,
w
,b
) = sign(
w
x
b
)
Any of thesewould be fine …… but which isbest?
CS 540, University of Wisconsin-Madison, C. R. Dyer
Specifying a Line and Margin
d
T
Plus-Plane
Minus-Plane
Classifier Boundary
“Predict Class = +1”
zone “Predict Class = -1”
zone
CS 540, University of Wisconsin-Madison, C. R. Dyer
Specifying a Line and Margin
Plus-plane
w
T
x
b
Minus-plane =
w
T
x
b
Plus-Plane
Minus-Plane
Classifier Boundary
“Predict Class = +1”
zone “Predict Class = -1”
zone
w
T
x
if
Universeexplodes
w
T
x
if
w
T
x
if
Classify as..
wx+b=1^ wx+b=
wx+b=-
Weight vector:
w
= (w
1 , …, w
)d T
Bias or threshold:
b
CS 540, University of Wisconsin-Madison, C. R. Dyer
Computing the Margin
Plus-plane
w x
b
Minus-plane =
w x
b
Claim:
The vector
w
is perpendicular to the Plus-Plane
“Predict Class = +1”
zone “Predict Class = -1”
zone
wx+b= wx+b=0^ wx+b=-
M =
Margin
(width)
M
w
b
w
CS 540, University of Wisconsin-Madison, C. R. Dyer
w
is the plane’s normal vector b is the distance from the origin
CS 540, University of Wisconsin-Madison, C. R. Dyer
Computing the Margin
Plus-plane
w x
b
Minus-plane =
w x
b
The vector
w
is perpendicular to the Plus Plane
Let
x
-^ be any point on the minus plane
Let
x
be the closest plus-plane-point to
x
“Predict Class = +1”
zone “Predict Class = -1”
zone
wx+b= wx+b=0^ wx+b=-
M =
Margin
M
w
b
Any location in ´^ m: not Any location inmRnecessarily adatapoint
: not necessarily adata point
w
CS 540, University of Wisconsin-Madison, C. R. Dyer
Computing the Margin
Plus-plane
w x
b
Minus-plane =
w x
b
The vector
w
is perpendicular to the Plus Plane
Let
x
-^ be any point on the minus plane
Let
x
be the closest plus-plane-point to
x
Claim
x
x
-^
λ w
for some value of
λ
Why?
“Predict Class = +1”
zone “Predict Class = -1”
zone
wx+b=1^ wx+b=
wx+b=-
M =
Margin
M
w
b
w
CS 540, University of Wisconsin-Madison, C. R. Dyer
Computing the Margin
Plus-plane
w x
b
Minus-plane =
w x
b
The vector
w
is perpendicular to the Plus Plane
Let
x
-^ be any point on the minus plane
Let
x
be the closest plus-plane-point to
x
Claim
x
+^
x
-^
λ w
for some value of
λ
Why?
“Predict Class = +1”
zone “Predict Class = -1”
zone
wx+b= wx+b=0^ wx+b=-
M =
Margin
M
w
b
The line from
x
-^
to
x
+^
is
perpendicular to theplanes So to get from
x
-^ to
x
travel some distance indirection
w
w
CS 540, University of Wisconsin-Madison, C. R. Dyer
Computing the Margin
What we know:•
w x
+^
b
w x
-^
b
x
x
-^
λ^
w
|^ x
x
-^
It’s now easy to get
in terms of
w
and
b
“Predict Class = +1”
zone “Predict Class = -1”
zone
wx+b=1^ wx+b=
wx+b=-
M =
Margin
w
CS 540, University of Wisconsin-Madison, C. R. Dyer
denotes +1denotes -
CS 540, University of Wisconsin-Madison, C. R. Dyer
denotes +1denotes -
w
CS 540, University of Wisconsin-Madison, C. R. Dyer
denotes +1denotes -
w
2
Tradeoff parameter
CS 540, University of Wisconsin-Madison, C. R. Dyer
denotes +1denotes -
w
2
Tradeoff parameter
Can’t be expressed as a Quadratic
Programming problem. Solving it may be too slow. (Also, doesn’t distinguish betweendisastrous errors and near misses)
So… any
otherideas?
CS 540, University of Wisconsin-Madison, C. R. Dyer
denotes +1denotes -
w
2
CS 540, University of Wisconsin-Madison, C. R. Dyer
Learning Maximum Margin with Noise
Given guess of
w
b,
we can
Compute sum of distancesof points to their correctzones
-^
Compute the margin width Assume
examples, each
(x
k^
yk
) where
y k^
wx+b= wx+b=0^ wx+b=-
M =
w w
What should our quadratic
optimization criterion be?
How many constraints will we
have? What should they be?
CS 540, University of Wisconsin-Madison, C. R. Dyer
Learning Maximum Margin with Noise
Given guess of
w
b we can
Compute sum of distancesof points to their correctzones
-^
Compute the margin width Assume
examples, each
(x
,k
yk
where
y k^
wx+b= wx+b=0^ wx+b=-
M =
w w
What should our quadratic
optimization criterion be? Minimize
1
1
. 2
N
k
k C
=
w w
ε^11 ε^7
ε^2
How many constraints will we
have?
What should they be? w
x
k^
b
εk
if
y k^
w
x
k^
b
εk
if
yk
CS 540, University of Wisconsin-Madison, C. R. Dyer
Suppose we’re in 1 Dimension
x=
CS 540, University of Wisconsin-Madison, C. R. Dyer
Project examples into some higher dimensional spacewhere the data
is
linearly separable, defined by
z
(x
Training depends only on dot products of the form
F(
xi )
F(
x
)j
Example:
K
F
F
i^
2
Dimensionality of
z
space is generally much larger than
the dimension of input space
x
2
2
1
1
2
2
CS 540, University of Wisconsin-Madison, C. R. Dyer
Common SVM Basis Functions
z
k^
=
x
k^
q
q
m
(x
,y
) = (x
y 1 1
y 2 2
2
= 1 + 2x
y 1 1
y 2 2
x 1
y 2
y 1 2
(^21) y
(^21)
(^22) y
(^22)
z
k^
=
x
k^
z
k^
=
x
k^
^
−
=
=
KW
|
|
KernelFn ) (
] [^
j
k
k j
k
j^
c
x
x
z
CS 540, University of Wisconsin-Madison, C. R. Dyer
K
,b
.
b
2
2
2
exp ) , (
b σ a
b a K
tanh( ) , (
δ
κ
b a
b a K
σ ,^ κ
and
δ
are magic
parameters that mustbe chosen by a modelselection methodsuch as CV or VCSRM
CS 540, University of Wisconsin-Madison, C. R. Dyer
The Federalist Papers
-^
-^
CS 540, University of Wisconsin-Madison, C. R. Dyer
Description
of
the
Data
For every paper: •^
Machine readable text was created using a scanner
-^
Computed relative frequencies of
words that
Mosteller-Wallace identified as good candidates forauthor-attribution studies
-^
Each document is represented as a vector containing the70 real numbers corresponding to the
word
frequencies
The dataset consists of
118
papers:
Madison papers
-^
Hamilton papers
-^
disputed papers
CS 540, University of Wisconsin-Madison, C. R. Dyer
Function Words Based on Relative
Frequencies
SLA Feature Selection for Classifying CS 540, University of Wisconsin-Madison, C. R. Dyer
the Disputed Federalist Papers
Apply the SVM Successive LinearizationAlgorithm for feature selection to: •^
-^
disputed papers
CS 540, University of Wisconsin-Madison, C. R. Dyer
Summary