How to get optimal value that best distinguishes two groups using SVM
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Greetings,
I am trying to learn more about classification using support vector machines. Accordingly, I have been following the MATLAB examples.
Now, with my own data, I have two groups, and one predictor variable (let's call it heart rate). My goal is to find the optimval value for heart rate that best distinguishes the two groups. I want to come up with a single value for heart rate for which I can say if they are above, they likely belong to group A, and if below, they likely belong to group B.
I have followed the fitcsvm and perfcurve examples, but am still confused as to how to come up with such an optimal value.
Any guidance with this would be greatly appreciated.
Thank you.
0 commentaires
Réponses (1)
Aditya Patil
le 16 Fév 2021
For svm with linear kernel, the boundary is given by the hyperplane at which the score function is equal to zero. In case of a single predictor, the "hyperplane" is a point. And the score function is where β is the coefficient, and b is bias. Hence, you can get the boundary for solving the equation for . Refer the code below for example.
X = [1:100]';
y = X < 80;
mdl = fitcsvm(X,y, 'KernelFunction',"linear");
% the equation for decision boundary is beta * x + bias = 0
% so x = -bias/beta
bnd = -1 * mdl.Bias / mdl.Beta
Note that this works only for linear kernels. For non linear kernels, SVM does not calculate score in terms of parameters, hence it's not possible to get an equation for the boundary. See this answers for details. You should use linear classifier in such a situation.
0 commentaires
Voir également
Catégories
En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!