DOC Fix docstring defaults that do not match the signature - #34772
Merged
ArturoAmorQ merged 1 commit intoAug 20, 2026
Merged
Conversation
|
Thank you for opening your first pull request to scikit-learn! 🎉 To help get your contribution reviewed, please make sure that:
|
ArturoAmorQ
approved these changes
Aug 20, 2026
prady0t
pushed a commit
to prady0t/scikit-learn
that referenced
this pull request
Sep 2, 2026
jeremiedbb
pushed a commit
to jeremiedbb/scikit-learn
that referenced
this pull request
Sep 8, 2026
jeremiedbb
pushed a commit
to jeremiedbb/scikit-learn
that referenced
this pull request
Sep 9, 2026
jeremiedbb
pushed a commit
to jeremiedbb/scikit-learn
that referenced
this pull request
Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reference Issues/PRs
None. These are docstring-only corrections where the documented default contradicts
the signature, which the Documentation section of the pull request checklist exempts
from needing an issue ("typos or obvious inconsistencies in the documentation").
What does this implement/fix? Explain your changes.
Nine parameters in seven files documented a default value that the function or
class signature contradicts. This PR corrects the docstrings to match the code. No
behaviour is changed.
HalvingGridSearchCVreturn_train_scoredefault=FalseTrue(_search_successive_halving.py:758)HalvingRandomSearchCVreturn_train_scoredefault=FalseTrue(_search_successive_halving.py:1139)randomized_svdrandom_statedefault='warn'None(extmath.py:411)spectral_clusteringn_clustersdefault=None8(_spectral.py:197)spectral_clusteringn_componentsdefault=n_clustersNone(_spectral.py:198)fetch_lfw_peoplemin_faces_per_persondefault=None0(_lfw.py:271)SequentialFeatureSelectorcvdefault=None5(_sequential.py:191)TargetEncodercvdefault=None5(_target_encoder.py:245)MiniBatchNMFverbosebool, default=False0(_nmf.py:1993)Two of these are settled by the codebase itself:
SpectralClusteringthe class already documentsn_clusters : int, default=8(
_spectral.py:407) andn_components : int, default=None ... If None, defaults to n_clusters. Thespectral_clusteringfunction in the same module disagrees withboth. These changes make the function match the class.
NMFdocumentsverbose : int, default=0(_nmf.py:1458), so do the three private helpersin that module (lines 453, 788, 1069).
MiniBatchNMFis the only onedocumenting it as
bool/False.randomized_svd'sdefault='warn'is left over from a deprecation cycle that endedin 1.2; the signature has been
Nonesince then.Introduce yourself
I am saikrishna working as a senior data engineer I have bachelors degree in computer science with data analytics specialization where I have worked on wide variety of tools like numpy, pandas, scikit-learn,... Where I have done various projects using various tools. Now I was reading the source looking for a bug to fix. So I wanted to contribute and help tool perform better.
AI usage disclosure
I used AI assistance for:
This pull request includes code written with the assistance of AI.
The code has not yet been reviewed by a human.
Any other comments?
On
return_train_score:BaseSearchCVdefaults this toFalse(_search.py:1696,_search.py:2095), while both halving classes override it toTrue. I have documentedthe behaviour as it currently is. Whether the
Trueoverride was intended is abehaviour question and I did not want to fold it into a documentation PR; happy to open
a separate issue if that is worth looking at. If reviewers would rather not touch that
one here, it can be dropped and the other eight are unaffected.
No changelog entry:
check-changelog.ymlonly requires one when a file matchingsklearn/.+test_.+\.pychanges, and this PR touches no test files.Checks run locally:
sklearn/tests/test_docstrings.py,sklearn/tests/test_docstring_parameters.pyandsklearn/tests/test_docstring_parameters_consistency.py(2939 passed), the test modulesfor all seven touched files (826 passed), and
ruff0.12.2 check and format.