DOC Clarify what the decision function in SVM calculates
@@ -383,7 +383,7 @@ class BaseLibSVM(six.with_metaclass(ABCMeta, BaseEstimator)):
return X
def _decision_function(self, X):
- """Distance of the samples X to the separating hyperplane.
+ """Evaluates the decision function for the samples in X.
Parameters
----------
@@ -528,7 +528,7 @@ class BaseSVC(six.with_metaclass(ABCMeta, BaseLibSVM, ClassifierMixin)):
return np.asarray(y, dtype=np.float64, order='C')
def decision_function(self, X):
- """Distance of the samples X to the separating hyperplane.
+ """Evaluates the decision function for the samples in X.
Parameters
----------
@@ -540,7 +540,16 @@ class BaseSVC(six.with_metaclass(ABCMeta, BaseLibSVM, ClassifierMixin)):
Returns the decision function of the sample for each class
in the model.
If decision_function_shape='ovr', the shape is (n_samples,
- n_classes)
+ n_classes).
+
+ Notes
+ ------
+ If decision_function_shape='ovo', the function values are proportional
+ to the distance of the samples X to the separating hyperplane. If the
+ exact distances are required, divide the function values by the norm of
+ the weight vector (``coef_``). See also `this question
+ <https://stats.stackexchange.com/questions/14876/
+ interpreting-distance-from-hyperplane-in-svm>`_ for further details.
"""
dec = self._decision_function(X)
if self.decision_function_shape == 'ovr' and len(self.classes_) > 2:
