GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [DOC] Fix the `shrinking` default documented for `svm._libsvm.cross_validation` by plunder707 · Pull Request #35364 · scikit-learn/scikit-learn

Conversation

@plunder707

@plunder707 plunder707 commented Nov 9, 2026

Copy link
Copy Markdown

[DOC] Fix the shrinking default documented for svm._libsvm.cross_validation

Reference Issues/PRs

None — found while auditing the docstring/code consistency of the SVM Cython bindings.

What does this implement/fix? Explain your changes.

sklearn/svm/_libsvm.pyx documents a default for shrinking that the binding does not have. In cross_validation:

 753:     int shrinking=0,          # signature default
 815:     shrinking : int, default=1   # docstring default

The docstring was evidently carried over from libsvm in the same file, where shrinking really does default to 1 (signature line 64, docstring line 122 — those two agree). cross_validation is the only binding in the file whose documented default disagrees with its signature, and probability, cache_size, max_iter, tol and random_seed all agree.

This PR changes only the documented default (line 815) to 0, so the docstring matches the signature. No behaviour changes.

Was the behavior checked?

  • inspect.signature(sklearn.svm._libsvm.cross_validation).parameters["shrinking"].default == 0, while inspect.getdoc(...) prints shrinking : int, default=1 — measured on installed scikit-learn 1.9.1 and 1.7.2 wheels.
  • On a 2500-sample RBF problem, cross_validation with the default, with shrinking=0 and with shrinking=1 produced identical predictions (shrinking is a solver optimisation, not a model choice), so this is a documentation-only correction.
  • The only in-tree caller is sklearn/svm/tests/test_svm.py, which omits shrinking and so runs with the heuristic disabled while the docstring advertises it as enabled.

Any adverse effects / open question

I am deliberately not changing the default: making cross_validation inherit libsvm's shrinking=1 would be a behaviour change in an internal binding whose callers currently get shrinking off, and that deserves a maintainer decision. If the intent was 1, the fix belongs in the signature, and this docstring change should be dropped in favour of that. Happy to convert this into a close-style cleanup of the stale docstring if maintainers prefer.

Checks

  • I have run the linter and pre-commit hooks locally (single docstring line in a .pyx file).
  • No public API, default value or behaviour is changed by this PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@plunder707
[DOC] Fix the shrinking default documented for `svm._libsvm.cross_v…
ac01ac5
…alidation`

Lane: knight/scripts/github_contribution_lane.py candidate sklearn-libsvm-cross-validation-shrinking-default digest 2b0bd72ae373
@github-actions github-actions Bot added module:svm cython size/XS labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Thank you for opening your first pull request to scikit-learn! 🎉

To help get your contribution reviewed, please make sure that:

  • You have filled out the pull request template.

  • The pull request addresses an existing issue that is ready for contribution (e.g. not tagged as 'Needs Triage', 'Needs Decision', ...). If you are proposing a new feature, please open an issue to discuss it first.

  • There are no other open pull requests already targeting the same issue.

  • You have followed the pull request checklist. In particular, linting and tests should pass.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the Documentation label Nov 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cython Documentation module:svm size/XS

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@plunder707
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.