Skip to content

DOC Clarify 'ovr' as the default strategy in the SVM documentation #29651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 25, 2025

Conversation

Shashank1202
Copy link
Contributor

Fix documentation to specify default decision_function_shape as 'ovr'

This update corrects the scikit-learn documentation for SVC and NuSVC to clearly state that the default setting for the decision_function_shape parameter is 'ovr' (one-vs-rest), not 'ovo' (one-versus-one). This improves clarity and resolves the discrepancy reported in issue #29340.

Copy link

github-actions bot commented Aug 10, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 310b57a. Link to the linter CI: here

Copy link
Member

@ArturoAmorQ ArturoAmorQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @Shashank1202. I would like to emphasize that this is a duplicate of #29363 and in general it is not a good practice to create duplicates without the OP consent.

I still made some suggestions because I think the general rewording is a better solution.

@@ -119,12 +119,14 @@ Multi-class classification
--------------------------

:class:`SVC` and :class:`NuSVC` implement the "one-versus-one"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:class:`SVC` and :class:`NuSVC` implement the "one-versus-one"
:class:`SVC` and :class:`NuSVC` implement the "one-versus-one" ('ovo')

Comment on lines 124 to 130
classifiers, with each one training data from two classes.
By default, however, the `decision_function_shape` parameter is set to `'ovr'`
(one-vs-rest), providing a consistent interface with other classifiers.

The ``decision_function_shape`` option allows for the results of the "one-versus-one"
classifiers to be monotonically transformed into a "one-vs-rest" decision
function of shape ``(n_samples, n_classes)``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
classifiers, with each one training data from two classes.
By default, however, the `decision_function_shape` parameter is set to `'ovr'`
(one-vs-rest), providing a consistent interface with other classifiers.
The ``decision_function_shape`` option allows for the results of the "one-versus-one"
classifiers to be monotonically transformed into a "one-vs-rest" decision
function of shape ``(n_samples, n_classes)``.
classifiers, each trained on data from two classes. Internally, the solver
always uses this ovo strategy to train the models. However, by default, the
`decision_function_shape` parameter is set to `'ovr'` (one-vs-rest), to have
a consistent interface with other classifiers by transforming the ovo results
into a "one-vs-rest" decision matrix of shape ``(n_samples, n_classes)``.

@ArturoAmorQ ArturoAmorQ changed the title #29340 Update SVM documentation to clarify 'ovr' as the default setting for … DOC Clarify 'ovr' as the default strategy in the SVM documentation Aug 13, 2024
@adrinjalali
Copy link
Member

I've merged the other PR. This PR can now improve upon that.

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I synchronized with main and applied the requested changes. LGTM. Thanks

@jeremiedbb jeremiedbb enabled auto-merge (squash) July 25, 2025 16:09
@jeremiedbb jeremiedbb merged commit 5833812 into scikit-learn:main Jul 25, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants