date: 2024-11-09
title: ML-As-3
status: DONE
author:
- AllenYGY
tags:
- MachineLearing
- Assignment
publish: True
ML-As-3
You are given the following two sets of data points, each belonging to one of the two classes
(class 1 and class -1):
Please find the optimal separating hyperplane using a linear SVM and derive the equation of the hyperplane. Assume the hard-margin SVM.
The hyperplane is defined through
Subject to the constraint
Final optimization problem:
The Lagrangian form:
where
The dual form of the optimization problem
subject to
If
Since the support vector is
The explicit form of the hyperplane.
Suppose we have the data points
For a soft-margin SVM, the optimization problem can be formulated as follows:
subject to:
where:
Dimensions:
The primal objective function is:
where
To derive the dual problem, we take the partial derivatives of
Partial derivative with respect to
Partial derivative with respect to
Partial derivative with respect to
By substituting
subject to:
The decision boundary is given by:
where
In the dual formulation,
By taking the partial derivatives with respect to
Consequently,
Consider the following
We want to use the polynomial kernel
To solve Problem 3 on Kernel SVM, let’s go through each part step-by-step.
The kernel matrix
Since
Using the results from Problem 2, the dual problem for a soft-margin SVM with a kernel function becomes:
subject to:
where
and
The bias
where we can use
Substitute
Calculating each term in the summation:
Summing these values:
To classify the point
Let’s compute each
Now, calculate
Substitute the values:
Calculate each term:
Adding them up with
Since