I am running ksvm in R(using kernlab package) for a highly imbalanced data.Is there any way i can get the distance of my test data points(each of dimension 8-10) from the hyperplane?so that i can conclude the far one point is from the hyperplane the more it belongs to that class(except misclassified points).is there any other package in R which can give me that distance?(even if not given directly how can i compute?)
Asked
Active
Viewed 978 times
1
-
SVM transforms your data by mapping to an higher dimensional space and then tries to linearly seperate in the transformed space. For the distance to the margin with linear searation see http://stats.stackexchange.com/questions/167682/getting-distance-of-points-from-decision-boundary-with-linear-svm/167691#167691 for the transformed space see http://stats.stackexchange.com/questions/80398/how-can-svm-find-an-infinite-feature-space-where-linear-separation-is-always-p/168309#168309 – Feb 14 '16 at 09:12
1 Answers
0
The distances will be returned by calling the predict
function on the model, the test data, and type = "decision"
. See http://www.inside-r.org/packages/cran/kernlab/docs/predict.ksvm

Jacques Wainer
- 5,032
- 1
- 20
- 32