SVM Hyperplane Calculation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

SVM Hyperplane Calculation

Uploaded image
Uploaded image
Uploaded image
analyze the SVM method and solve the given question

The question relates to Support Vector Machines (SVMs), which classify data points by finding the
optimal hyperplane that separates two classes. Let’s break this down step by step for the data points (A,
B, C) provided:

Understanding the Problem

The data points provided are:

A: (x1 , x2 )
​ = (1, 1), y = +1

B: (x1 , x2 ) = (2, 3), y = +1


​ ​

C: (x1 , x2 ) = (3, 2), y = −1


​ ​

We need to:

1. Determine the optimal hyperplane to separate the two classes using SVM.
2. Solve the resulting equations to find the hyperplane parameters w (normal vector) and b
(bias/offset).

1. SVM Theory:

The hyperplane is given as:

w 1 x1 + w 2 x2 + b = 0
​ ​ ​ ​

where w = (w1 , w2 ) is the normal vector and b is the bias.


​ ​

For any data point xi with label yi , the following condition must hold:
​ ​

yi ⋅ (wT xi + b) ≥ 1
​ ​

This ensures that the points lie either on or outside the margin boundaries.

2. Solve for the Hyperplane:

We will construct the equations based on the conditions y ⋅ (wT x + b) = 1 for the support vectors.

Data Points:

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 1/3
1. For point A (1, 1), y = +1:

w1 ⋅ 1 + w2 ⋅ 1 + b = 1
​ ​

Simplifies to:

w1 + w2 + b = 1 (Equation 1)
​ ​

2. For point B (2, 3), y = +1:

w1 ⋅ 2 + w2 ⋅ 3 + b = 1
​ ​

Simplifies to:

2w1 + 3w2 + b = 1 (Equation 2)


​ ​

3. For point C (3, 2), y = −1:

w1 ⋅ 3 + w2 ⋅ 2 + b = −1
​ ​

Simplifies to:

3w1 + 2w2 + b = −1 (Equation 3)


​ ​

3. Solve the Simultaneous Equations:

We solve the three linear equations:

1. w1+ w2 + b = 1
​ ​

2. 2w1 + 3w2 + b = 1
​ ​

3. 3w1 + 2w2 + b = −1
​ ​

Step 1: Subtract Equation 1 from Equation 2:

(2w1 + 3w2 + b) − (w1 + w2 + b) = 1 − 1


​ ​ ​

w1 + 2w2 = 0 (Equation 4) ​

Step 2: Subtract Equation 1 from Equation 3:

(3w1 + 2w2 + b) − (w1 + w2 + b) = −1 − 1


​ ​ ​ ​

2w1 + w2 = −2 (Equation 5)
​ ​

Step 3: Solve Equations 4 and 5:

From Equation 4:

w1 = −2w2 ​ ​

Substitute w1 ​ = −2w2 into Equation 5:


Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 2/3
2(−2w2 ) + w2 = −2 ​ ​

−4w2 + w2 = −2 ​ ​

2
−3w2 = −2 ⟹ w2 =
3
​ ​ ​

2
Substitute w2 ​ = 3
​into w1 = −2w2 :
​ ​

2 4
w1 = −2 ⋅ =−
3 3
​ ​ ​

4. Solve for b:

Substitute w1 ​ = − 43 and w2 =
​ ​
2
3
​into Equation 1:

w1 + w2 + b = 1
​ ​

4 2
− + +b=1
3 3
​ ​

2
− +b=1
3

2 5
b=1+ =
3 3
​ ​

5. Final Hyperplane:

The hyperplane equation is:

4 2 5
− x1 + x2 + = 0
3 3 3
​ ​ ​ ​ ​

Simplify by multiplying through by 3 to clear the denominators:

−4x1 + 2x2 + 5 = 0 ​ ​

or equivalently:

4x1 − 2x2 = 5 ​ ​

6. Interpretation:

Normal vector w = (−4, 2)


Bias b = 53 ​

The hyperplane separates the positive and negative classes while maximizing the margin.

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 3/3

You might also like