10000 DOC Clarify what the decision function in SVM calculates (#12708) · scikit-learn/scikit-learn@01b37f8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 01b37f8

Browse files
JanSellnerjnothman
authored andcommitted
DOC Clarify what the decision function in SVM calculates (#12708)
1 parent bf2f648 commit 01b37f8

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

sklearn/svm/base.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def _compute_kernel(self, X):
383383
return X
384384

385385
def _decision_function(self, X):
386-
"""Distance of the samples X to the separating hyperplane.
386+
"""Evaluates the decision function for the samples in X.
387387
388388
Parameters
389389
----------
@@ -528,7 +528,7 @@ def _validate_targets(self, y):
528528
return np.asarray(y, dtype=np.float64, order='C')
529529

530530
def decision_function(self, X):
531-
"""Distance of the samples X to the separating hyperplane.
531+
"""Evaluates the decision function for the samples in X.
532532
533533
Parameters
534534
----------
@@ -540,7 +540,16 @@ def decision_function(self, X):
540540
Returns the decision function of the sample for each class
541541
in the model.
542542
If decision_function_shape='ovr', the shape is (n_samples,
543-
n_classes)
543+
n_classes).
544+
545+
Notes
546+
------
547+
If decision_function_shape='ovo', the function values are proportional
548+
to the distance of the samples X to the separating hyperplane. If the
549+
exact distances are required, divide the function values by the norm of
550+
the weight vector (``coef_``). See also `this question
551+
<https://stats.stackexchange.com/questions/14876/
552+
interpreting-distance-from-hyperplane-in-svm>`_ for further details.
544553
"""
545554
dec = self._decision_function(X)
546555
if self.decision_function_shape == 'ovr' and len(self.classes_) > 2:

0 commit comments

Comments
 (0)
0