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

Skip to content

FIX radius_neighbors with array-like radius and n_jobs > 1 for tree-based algorithms - #34341

Merged
lesteve merged 3 commits into
scikit-learn:mainfrom
nicolassalvy:fix-radius-neighbors-njobs-array
Aug 16, 2026
Merged

FIX radius_neighbors with array-like radius and n_jobs > 1 for tree-based algorithms#34341
lesteve merged 3 commits into
scikit-learn:mainfrom
nicolassalvy:fix-radius-neighbors-njobs-array

Conversation

@nicolassalvy

@nicolassalvy nicolassalvy commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #34338
Towards #25970

What does this implement/fix? Explain your changes.

When radius is passed as a per-sample array, NearestNeighbors.radius_neighbors returns a correct result with n_jobs=1 but used to raise a ValueError with n_jobs>1 on identical input for both ball_tree and kd_tree. This PR fixes that by slicing radius together with the already sliced data X when radius is not a scalar.

@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.

@ogrisel ogrisel 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.

LGTM, thanks!

@ogrisel

ogrisel commented Jun 23, 2026

Copy link
Copy Markdown
Member

Actually, no: we need a changelog entry as reported by the CI. Here are the instructions:

https://github.com/scikit-learn/scikit-learn/blob/main/doc/whats_new/upcoming_changes/README.md

@github-actions github-actions Bot added the CI:Linter failure The linter CI is failing on this PR label Jun 23, 2026
@nicolassalvy

Copy link
Copy Markdown
Contributor Author

Thanks for the link, I added the missing changelog entry!

@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Jun 23, 2026
@lesteve
lesteve merged commit cedc9d8 into scikit-learn:main Aug 16, 2026
38 checks passed
@lesteve

lesteve commented Aug 16, 2026

Copy link
Copy Markdown
Member

Merging this one, thanks!

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 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
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.

radius_neighbors with array radius works with n_jobs=1 but raises ValueError for n_jobs>1

3 participants