How do I get the distance between the point and the hyperplane in MATLAB 2021a fitcsvm?

13 Ansichten (letzte 30 Tage)
Hi all,
Nested cross-validation method gives me the best model 1x1 ClassificationSVM, please see attached. This models gives an accuracy of 94.53% (using crossval).
I was wondering if there is an easy way to calculate the distance between the point and the hyperplane from this output?
Thanks,
Sahil

Antworten (1)

Kshitij Chhabra
Kshitij Chhabra am 13 Okt. 2021
Hi Sahil,
From my understanding you are trying to find the distance of a particular data point from the hyperplane. I can recommmend you using the the "predict" function to get the Classification Score which is the signed distance of a point x form the decision boundary and ranges from -∞ to +∞.
You can learn more about the use of "predict" function here.
Hope this helps!
  1 Kommentar
Sahil Bajaj
Sahil Bajaj am 18 Okt. 2021
Hi Kshitij, thanks for your response.
Yes, I used "predict" function to get the classification score. But somehow this classification scores (which represents the signed distance of a point x from the decision boundary) is different from the distance parameter I get using libsvm (as explained here: https://www.mathworks.com/matlabcentral/answers/410858-how-do-i-get-the-distance-between-the-point-and-the-hyperplane-using-libsvm). I am not sure why both "classification score from predict" and "distance" calculation using libsvm as explained in this article are not identical - and if both of these represent different things then which one should I use to get the distance of all data points from the hyperplane?
I would really appreciate any help.
Thanks,
Sahil

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by