MATLAB Answers

Finding SVM hyperplane equation for 2nd order polynomial

101 views (last 30 days)
Hello, I was using the Support Vector Machine model calculation for a 2nd order hyperplane to separate two classes:
SVMmodel = fitcsvm(predictors,response, ...
'KernelFunction', 'polynomial', ...
'PolynomialOrder', 2, ...
'KernelScale', kernelscale, ...
'BoxConstraint', boxconstraint, ...
'Standardize', true, ...
'ClassNames',[1; 2]);
But the resulting function has the Beta parameters (that indicate the hyperplane equation) completely empty.
How can I find the equation then for the 2nd order hyperplane, or have the function provide me with the beta values?
Is this a bug?
This is what the resulting struct looks like:
Thanks a lot.

Accepted Answer

Aditya Patil
Aditya Patil on 4 Feb 2021
In SVM, the beta value is used to find score only in case of linear kernel, as either no feature transformation or explicit feature transformation is done. However in case of other kernels, the feature transformation is implicit(using the “kernel trick”), hence the beta value is never calculated.
This is further elaborated in the following equations. For the linear kernel, , where is bias. While for other kernels, , where G is gram matrix. As this equation is not in terms of x, you can't get the score function in terms of x.
The predict function optionally provides scores. This can be used to plot the decision boundary. You can check the support vector machines for binary classification documentation for an example. As the score is distance of the point from the decision boundary, finding where the score is zero gives the decision boundary.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!