Machine learning Support vector Machine case study which implies

AnoopCadlord1 19 views 36 slides Sep 06, 2024
Slide 1
Slide 1 of 36
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36

About This Presentation

Machine learning


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
??????(&#3627408485;
1)=??????(&#3627408485;
2)=0

Finding Separating Hyperplane with maximum Margin?
Let us take two points x
1and x
2lying on g(x)
????????????=??????
??????
??????+??????
0=0
??????(&#3627408485;
1)=??????(&#3627408485;
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
??????(&#3627408485;
1)=??????(&#3627408485;
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(??????).
⇒????????????=??????
??????
??????
??????+??????
??????
??????
??????
??????
+??????
&#3627409358;
⇒????????????=??????
??????
??????
??????+??????
&#3627409358;+??????
??????
??????
??????
??????
⇒????????????=??????
??????
??????
??????
??????
⇒??????=
??????(??????)
??????

Finding Separating Hyperplane with maximum Margin?
Distance of ??????
??????from g(x)=0 is
⇒??????
&#3627409358;=
??????
??????
&#3627409358;+??????
0
??????
??????=
??????(??????)
??????
??????=
??????(??????)
??????
So, the distance of origin from g(x)=0 is
⇒??????
&#3627409358;=
??????
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 <??????
??????,&#3627408486;
??????> where &#3627408486;
????????????{+????????????,−????????????}is the class
label of ??????
??????,
•let us replace –veby +1, and –veby -1.

Finding Separating Hyperplane with maximum Margin?
??????
??????
??????
??????+??????
&#3627409358;≥1,∀&#3627408486;
??????=+1
To define the expression for H+ and H-, let us make the
following assumptions.
Given a datapoint <??????
??????,&#3627408486;
??????> where &#3627408486;
????????????{+????????????,−????????????}is the class
label of ??????
??????,
•Let us replace –veby +1, and –veby -1.
•Now, each data point will satisfy the following
??????
??????
??????
??????+??????
&#3627409358;≤−1,∀&#3627408486;
??????=−1

Finding Separating Hyperplane with maximum Margin?
??????
??????
??????
??????+??????
&#3627409358;≥1,∀&#3627408486;
??????=+1
To define the expression for H+ and H-, let us make the
following assumptions.
Given a datapoint <??????
??????,&#3627408486;
??????> where &#3627408486;
????????????{+????????????,−????????????}is the class
label of ??????
??????,
•let us replace –veby +1, and –veby -1.
•Now, each data point will satisfy the following
??????
??????
??????
??????+??????
&#3627409358;≤−1,∀&#3627408486;
??????=−1
The above two expression can be merged to form a single expression
&#3627408486;
??????(??????
??????
??????
??????+??????
&#3627409358;)≥1,∀??????
??????

Finding Separating Hyperplane with maximum Margin?
??????
??????
??????
??????+??????
&#3627409358;≥1,∀&#3627408486;
??????=+1
To define the expression for H+ and H-, let us make the
following assumptions.
Given a datapoint <??????
??????,&#3627408486;
??????> where &#3627408486;
????????????{+????????????,−????????????}is the class
label of ??????
??????,
•let us replace –veby +1, and –veby -1.
•Now, each data point will satisfy the following
??????
??????
??????
??????+??????
&#3627409358;≤−1,∀&#3627408486;
??????=−1
The above two expression can be merged to form a single expression
&#3627408486;
??????(??????
??????
??????
??????+??????
&#3627409358;)≥1,∀??????
??????
&#3627408486;
??????(??????
??????
??????
??????+??????
&#3627409358;)−1≥0,∀??????
??????

Finding Separating Hyperplane with maximum Margin?
????????????=??????
??????
??????+??????
&#3627409358;=1
????????????=??????
??????
??????+??????
&#3627409358;=−1
????????????=??????
??????
??????+??????
&#3627409358;=0
H+:
H-:
H:

Finding Separating Hyperplane with maximum Margin?
????????????=??????
??????
??????+??????
&#3627409358;=1
????????????=??????
??????
??????+??????
&#3627409358;=−1
????????????=??????
??????
??????+??????
&#3627409358;=0
H+:
H-:
H:
Margin=??????
??????
+−??????
??????

=
??????
0−1
??????

??????
0+1
??????
=
??????
0−1−??????
0−1
??????
⇒????????????????????????????????????=
−2
??????

Finding Separating Hyperplane with maximum Margin?
????????????=??????
??????
??????+??????
&#3627409358;=1
????????????=??????
??????
??????+??????
&#3627409358;=−1
????????????=??????
??????
??????+??????
&#3627409358;=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
??????
&#3627409360;
Minimizing
??????
&#3627409360;
is equivalent to minimizing
??????
??????
??????
&#3627409360;

Finding Separating Hyperplane with maximum Margin?
Minimizeobjective function
??????
??????
??????
&#3627409360;
Subject to the constraint
&#3627408486;
??????(??????
??????
??????
??????+??????
&#3627409358;)≥1,∀??????
??????
Now, we need to solve the following optimization

Finding Separating Hyperplane with maximum Margin?
Objective function is to minimize
??????
??????
??????
&#3627409360;
Subject to
&#3627408486;
??????(??????
??????
??????
??????+??????
&#3627409358;)≥1,∀??????
??????
??????
??????=
??????
??????
??????
&#3627409360;
−෍
??????=&#3627409359;
??????
λ
??????&#3627408486;
??????(??????
??????
??????
??????+??????
&#3627409358;)−1
where λ
??????areLagrange multipliers
To find the parameters ??????and where ??????
0, solve
the following optimization function

What are the support vectors?
??????
??????=
??????
??????
??????
&#3627409360;
−෍
??????=&#3627409359;
??????
λ
??????&#3627408486;
??????(??????
??????
??????
??????+??????
&#3627409358;)−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