Skip to content

Commit 5833812

Browse files
authored
DOC Clarify 'ovr' as the default decision function shape strategy in the SVM documentation (scikit-learn#29651)
1 parent 6037c68 commit 5833812

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

doc/modules/svm.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,14 @@ properties of these support vectors can be found in attributes
119119
Multi-class classification
120120
--------------------------
121121

122-
:class:`SVC` and :class:`NuSVC` implement the "one-versus-one"
123-
approach for multi-class classification. In total,
122+
:class:`SVC` and :class:`NuSVC` implement the "one-versus-one" ("ovo")
123+
approach for multi-class classification, which constructs
124124
``n_classes * (n_classes - 1) / 2``
125-
classifiers are constructed and each one trains data from two classes.
126-
To provide a consistent interface with other classifiers, the
127-
``decision_function_shape`` option allows to monotonically transform the
128-
results of the "one-versus-one" classifiers to a "one-vs-rest" decision
129-
function of shape ``(n_samples, n_classes)``, which is the default setting
130-
of the parameter (default='ovr').
125+
classifiers, each trained on data from two classes. Internally, the solver
126+
always uses this "ovo" strategy to train the models. However, by default, the
127+
`decision_function_shape` parameter is set to `"ovr"` ("one-vs-rest"), to have
128+
a consistent interface with other classifiers by monotonically transforming the "ovo"
129+
decision function into an "ovr" decision function of shape ``(n_samples, n_classes)``.
131130

132131
>>> X = [[0], [1], [2], [3]]
133132
>>> Y = [0, 1, 2, 3]
@@ -142,7 +141,7 @@ of the parameter (default='ovr').
142141
>>> dec.shape[1] # 4 classes
143142
4
144143

145-
On the other hand, :class:`LinearSVC` implements "one-vs-the-rest"
144+
On the other hand, :class:`LinearSVC` implements a "one-vs-rest" ("ovr")
146145
multi-class strategy, thus training `n_classes` models.
147146

148147
>>> lin_clf = svm.LinearSVC()

0 commit comments

Comments
 (0)