How do I get the distance between the point and the hyperplane using libsvm?
4 次查看(过去 30 天)
显示 更早的评论
I am using libsvm. I need to know, which observations are farest away from the hyperplane. libsvm returns me the "decision_value" but how can I use it to get the distance from the hyperplane? Taking the largest positive and smallest negative values or do I have to compute it manually and if yes, how?
0 个评论
采纳的回答
Rishabh Gupta
2018-8-2
Hey Stef
You can find the distance of a point i from hyperplane as follows:
distance_i = |decision_value|_i / |w|-b
where,
w = (alpha * support_vectors)
|w| = sqrt(sum(w^2))
alphas, support_vectors and b is generated from SVM model
5 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!