Machine learning Support vector Machine case study which implies
AnoopCadlord1
19 views
36 slides
Sep 06, 2024
Slide 1 of 36
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
About This Presentation
Machine learning
Size: 486.81 KB
Language: en
Added: Sep 06, 2024
Slides: 36 pages
Slide Content
Lesson 6
Support vector machine (SVM)
Support vector machine
Support vector machine
Support vector machine
Support vector machine
Support vector machine –Linear or Non-linear
Linear SVM
Non-Linear SVM
Non-Linear to Linear
Linear Support vector machine
Linear Support vector machine
Linear Support vector machine
????????????=??????
??????
??????+??????
0=0
For all the points on the hyper plane, g(x) = 0
Linear Support vector machine
????????????=??????
??????
??????+??????
0>0
For all the points above the hyper plane, g(x) > 0
Linear Support vector machine
????????????=??????
??????
??????+??????
0<0
For all the points below the hyper plane, g(x) < 0
Linear Support vector machine
????????????=??????
??????
??????+??????
0=0
????????????=??????
??????
??????+??????
0<0
????????????=??????
??????
??????+??????
0>0
We choose the hyperplane that has
the maximum separating margin
What is Separating Margin?
H is the separating hyperplane
H
+
is the plane parallel to H and passing through the
nearest +vepoints to H
H
-
is the plane parallel to H and passing through the
nearest -vepoints to H
Separating margin is the distance between H
+
and H
-
We choose H that has the maximum margin.
Finding Separating Hyperplane with maximum Margin?
????????????=??????
??????
??????+??????
0=0
Finding Separating Hyperplane with maximum Margin?
Let us take two points x
1and x
2lying on g(x)
????????????=??????
??????
??????+??????
0=0
??????(�
1)=??????(�
2)=0
Finding Separating Hyperplane with maximum Margin?
Let us take two points x
1and x
2lying on g(x)
????????????=??????
??????
??????+??????
0=0
??????(�
1)=??????(�
2)=0
⇒??????
??????
??????
1+??????
0=??????
??????
??????
1+??????
0
⇒??????
??????
??????
1−??????
1=0
Finding Separating Hyperplane with maximum Margin?
Let us take two points x
1and x
2lying on g(x)
????????????=??????
??????
??????+??????
0=0
??????(�
1)=??????(�
2)=0
⇒??????
??????
??????
1+??????
0=??????
??????
??????
1+??????
0
⇒??????
??????
??????
1−??????
1=0
It means ??????is orthogonal (90
o
/perpendicular) the vector (x
1-x
2).
It means ??????is orthogonal (90
o
/perpendicular) to g(x).
Finding Separating Hyperplane with maximum Margin?
Let x be a point in space.
Let rbe the distance of the point xfrom the hyperplane g(x),
and x
pbe the corresponding projection point of xon g(x).
Now, vector ??????can be defined by the sum of the vector ??????
??????and vector ??????.
??????=??????
??????+??????
⇒??????=??????
??????+??????
??????
??????
Finding Separating Hyperplane with maximum Margin?
Let x be a point in space.
Let rbe the distance of the point xfrom the hyperplane g(x),
and x
pbe the corresponding projection point of xon g(x).
Now, vector ??????can be defined by the sum of the vector ??????
??????and vector ??????.
??????=??????
??????+??????
⇒??????=??????
??????+??????
??????
??????
If you substitute ??????in g(??????).
⇒????????????=??????
??????
??????
??????+??????
??????
??????
??????
??????
+??????
�
⇒????????????=??????
??????
??????
??????+??????
�+??????
??????
??????
??????
??????
⇒????????????=??????
??????
??????
??????
??????
⇒??????=
??????(??????)
??????
Finding Separating Hyperplane with maximum Margin?
Distance of ??????
??????from g(x)=0 is
⇒??????
�=
??????
??????
�+??????
0
??????
??????=
??????(??????)
??????
??????=
??????(??????)
??????
So, the distance of origin from g(x)=0 is
⇒??????
�=
??????
0
??????
Finding Separating Hyperplane with maximum Margin?
What is the Margin between H+ and H-?
Finding Separating Hyperplane with maximum Margin?
To define the expression for H+ and H-, let us make the
following assumptions.
Given a datapoint <??????
??????,�
??????> where �
????????????{+????????????,−????????????}is the class
label of ??????
??????,
•let us replace –veby +1, and –veby -1.
Finding Separating Hyperplane with maximum Margin?
??????
??????
??????
??????+??????
�≥1,∀�
??????=+1
To define the expression for H+ and H-, let us make the
following assumptions.
Given a datapoint <??????
??????,�
??????> where �
????????????{+????????????,−????????????}is the class
label of ??????
??????,
•Let us replace –veby +1, and –veby -1.
•Now, each data point will satisfy the following
??????
??????
??????
??????+??????
�≤−1,∀�
??????=−1
Finding Separating Hyperplane with maximum Margin?
??????
??????
??????
??????+??????
�≥1,∀�
??????=+1
To define the expression for H+ and H-, let us make the
following assumptions.
Given a datapoint <??????
??????,�
??????> where �
????????????{+????????????,−????????????}is the class
label of ??????
??????,
•let us replace –veby +1, and –veby -1.
•Now, each data point will satisfy the following
??????
??????
??????
??????+??????
�≤−1,∀�
??????=−1
The above two expression can be merged to form a single expression
�
??????(??????
??????
??????
??????+??????
�)≥1,∀??????
??????
Finding Separating Hyperplane with maximum Margin?
??????
??????
??????
??????+??????
�≥1,∀�
??????=+1
To define the expression for H+ and H-, let us make the
following assumptions.
Given a datapoint <??????
??????,�
??????> where �
????????????{+????????????,−????????????}is the class
label of ??????
??????,
•let us replace –veby +1, and –veby -1.
•Now, each data point will satisfy the following
??????
??????
??????
??????+??????
�≤−1,∀�
??????=−1
The above two expression can be merged to form a single expression
�
??????(??????
??????
??????
??????+??????
�)≥1,∀??????
??????
�
??????(??????
??????
??????
??????+??????
�)−1≥0,∀??????
??????
Finding Separating Hyperplane with maximum Margin?
????????????=??????
??????
??????+??????
�=1
????????????=??????
??????
??????+??????
�=−1
????????????=??????
??????
??????+??????
�=0
H+:
H-:
H:
Margin=??????
??????
+−??????
??????
−
=
??????
0−1
??????
−
??????
0+1
??????
=
??????
0−1−??????
0−1
??????
⇒????????????????????????????????????=
−2
??????
As we are interested in the absolute value, we consider the margin as
2
??????
Finding Separating Hyperplane with maximum Margin?
????????????????????????????????????=
2
??????
⇒????????????????????????????????????=
1
??????
2
Task is to find the hyperplane (g(x)=0) that maximizes
the margin
2
??????
Finding Separating Hyperplane with maximum Margin?
????????????????????????????????????=
2
??????
⇒????????????????????????????????????=
1
??????
2
Task is to find the hyperplane (g(x)=0) that maximizes
the margin
2
??????
Maximizing
2
??????
is equivalent to minimizing
??????
�
Minimizing
??????
�
is equivalent to minimizing
??????
??????
??????
�
Finding Separating Hyperplane with maximum Margin?
Minimizeobjective function
??????
??????
??????
�
Subject to the constraint
�
??????(??????
??????
??????
??????+??????
�)≥1,∀??????
??????
Now, we need to solve the following optimization
Finding Separating Hyperplane with maximum Margin?
Objective function is to minimize
??????
??????
??????
�
Subject to
�
??????(??????
??????
??????
??????+??????
�)≥1,∀??????
??????
??????
??????=
??????
??????
??????
�
−
??????=�
??????
λ
??????�
??????(??????
??????
??????
??????+??????
�)−1
where λ
??????areLagrange multipliers
To find the parameters ??????and where ??????
0, solve
the following optimization function
What are the support vectors?
??????
??????=
??????
??????
??????
�
−
??????=�
??????
λ
??????�
??????(??????
??????
??????
??????+??????
�)−1
[
In order to find the parameters, we need to solve this objective function.
]
Summary
•What is separating hyperplane?
•How to define separating hyperplane?
•What are Support Vector Machine?
•How to classify a new example using SVM