How do I get the distance between the point and the hyperplane in MATLAB 2021a fitcsvm?
10 views (last 30 days)
Show older comments
Sahil Bajaj on 2 Oct 2021
Commented: Sahil Bajaj on 18 Oct 2021
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?
Kshitij Chhabra on 13 Oct 2021
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!
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!