Does the decision function return the actual distance to the hyperplane for each sample as stated here. Or do you have to the extra calculation as shown here. Which method should be used?
Asked
Active
Viewed 1,144 times
1 Answers
1
No, that's not the actual distance. And depends on the case, you may (linear kernel) or may not (non-linear kernel) be able to convert that to an actually distance. Here is another good explanation. Not matter what, yes you have to take that extra step if you want the actual distance.

Y. Luo
- 5,622
- 1
- 18
- 25
-
Does this also impy the margin distance is normalized to 1? – gman9732 Jun 16 '17 at 12:01
-
@gman9732 According to the [mathematical formulation](http://scikit-learn.org/stable/modules/svm.html#mathematical-formulation), yes. And that's why for `LinearSVC` you can use `np.linalg.norm()` to get the actual distance. – Y. Luo Jun 16 '17 at 18:53
-
Does the mean the margin distance *is* 1. And I am able to determine if a point is in the margin by seeing if its distance is < 1? – gman9732 Jun 20 '17 at 18:10
-
Yes in general, but not exactly. As you can see from the [mathematical formulation](http://scikit-learn.org/stable/modules/svm.html#mathematical-formulation), the model is solved so that the margin is greater or equal to 1-ζi. Therefore, the margin distance from you training points may be slightly less (depends on ζi) than 1. And a point in the margin should have a normalized distance less than 1-ζi rather than 1. – Y. Luo Jun 20 '17 at 23:06