Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC fix incorrect default for random_state in estimate_bandwidth docstring - #34291

Merged
StefanieSenger merged 2 commits into
scikit-learn:mainfrom
Kropiunig:doc/estimate-bandwidth-random-state-default
Jun 27, 2026
Merged

DOC fix incorrect default for random_state in estimate_bandwidth docstring#34291
StefanieSenger merged 2 commits into
scikit-learn:mainfrom
Kropiunig:doc/estimate-bandwidth-random-state-default

Conversation

@Kropiunig

Copy link
Copy Markdown
Contributor

The signature of estimate_bandwidth uses random_state=0, but its docstring documents default=None, which contradicts the actual behavior (deterministic subsampling by default). The default=None text dates to the 2020 docstring standardization (#16056). This corrects the docstring to default=0; docstring-only, no behavior change.

@github-actions

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.

@StefanieSenger StefanieSenger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your doc fix, @Kropiunig.

Next, you have to fix the param_validation, too (you'll need to add StrOptions as a possible input for the random_state param).

@Kropiunig

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @StefanieSenger. Before I touch the validation, could you confirm what you have in mind? Looking at the current code, estimate_bandwidth already uses "random_state": ["random_state"] in @validate_params, and its default is the integer 0 (the docstring fix just corrects default=None to default=0). check_random_state accepts only None, an int, or a RandomState instance, so I don't see a string value that the function would accept — the one place StrOptions is paired with random_state (TargetEncoder) is specifically the deprecation sentinel "deprecated", which doesn't apply here. Am I missing a case where a string should be valid, or did you perhaps mean a different change? Happy to add it once I understand the intended constraint.

@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Jun 27, 2026
@StefanieSenger

Copy link
Copy Markdown
Member

Happy to add it once I understand the intended constraint.

Sorry @Kropiunig, not sure what I meant there. Your PR is good to go as is.

@StefanieSenger
StefanieSenger enabled auto-merge (squash) June 27, 2026 17:15
@StefanieSenger
StefanieSenger merged commit e504dc6 into scikit-learn:main Jun 27, 2026
38 checks passed
prady0t pushed a commit to prady0t/scikit-learn that referenced this pull request Sep 2, 2026
@jeremiedbb jeremiedbb mentioned this pull request Sep 8, 2026
14 tasks
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 9, 2026
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.

2 participants