Skip to content

Fix call to NearestNeighbors.kneighbors() without args.#6333

Merged
rapids-bot[bot] merged 3 commits intorapidsai:branch-25.04from
csadorf:fix-nearest-neighbors-kneighbors-call-without-args
Feb 21, 2025
Merged

Fix call to NearestNeighbors.kneighbors() without args.#6333
rapids-bot[bot] merged 3 commits intorapidsai:branch-25.04from
csadorf:fix-nearest-neighbors-kneighbors-call-without-args

Conversation

@csadorf
Copy link
Copy Markdown
Contributor

@csadorf csadorf commented Feb 18, 2025

Alternative solution for #6317 .

@csadorf csadorf added bug Something isn't working non-breaking Non-breaking change cuml-cpu labels Feb 18, 2025
@csadorf csadorf self-assigned this Feb 18, 2025
@csadorf csadorf requested a review from a team as a code owner February 18, 2025 18:42
@csadorf csadorf requested review from betatim and dantegd February 18, 2025 18:42
@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Feb 18, 2025
@csadorf csadorf force-pushed the fix-nearest-neighbors-kneighbors-call-without-args branch from ff0a5d9 to 02d16e9 Compare February 18, 2025 18:43
@dantegd
Copy link
Copy Markdown
Member

dantegd commented Feb 19, 2025

Should we add the pytest from #6317?

@betatim
Copy link
Copy Markdown
Member

betatim commented Feb 19, 2025

This looks nice to me, though I have to admit that I could not explain to you why this works/if this is what the creators of the decorators wanted us to do. But that is more a comment about the state that the decorator stuff is in than this PR.

@csadorf
Copy link
Copy Markdown
Contributor Author

csadorf commented Feb 19, 2025

Should we add the pytest from #6317?

Added in 09ada6a .

@csadorf
Copy link
Copy Markdown
Contributor Author

csadorf commented Feb 19, 2025

I realized that my implementation was in fact breaking (as surfaced by the failing doc-string example test) so decided to adopt and build on top of @betatim 's solution after all. After careful review and some testing I believe that this revision should be safe to introduce and does not break current behavior.

# Check for default name in input args
if arg_name in sig.parameters:
return arg_name, params.index(arg_name)
param = sig.parameters[arg_name]
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.

Can't remember off the top of my head, but the refactor of decorators you are doing removes this auto inspection of signature, no? Just wondering since it'd be nice to not have magic behavior of this.

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.

Can you explain a bit more? The code here looks more or less the same, so maybe you mean something that effects something somewhere else because of this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@dantegd I am a big confused by your question as well. Yes, the infrastructure revision will eliminate much of the magic and guess work, but here I am just inspecting the signature similar like before, but account for a provided default argument similar to how @betatim structured this in the earlier PR.

@csadorf csadorf force-pushed the fix-nearest-neighbors-kneighbors-call-without-args branch from 503f415 to d16508a Compare February 20, 2025 18:13
@csadorf
Copy link
Copy Markdown
Contributor Author

csadorf commented Feb 20, 2025

/merge

@rapids-bot rapids-bot Bot merged commit 6fee413 into rapidsai:branch-25.04 Feb 21, 2025
dantegd added a commit to dantegd/cuml that referenced this pull request Feb 21, 2025
@csadorf csadorf deleted the fix-nearest-neighbors-kneighbors-call-without-args branch February 21, 2025 14:49
dantegd added a commit to dantegd/cuml that referenced this pull request Feb 26, 2025
raydouglass pushed a commit that referenced this pull request Feb 28, 2025
PRs being backported: 

- [x] #6234
- [x] #6306
- [x] #6320
- [x] #6319
- [x] #6327
- [x] #6333
- [x] #6142 
- [x] #6223
- [x] #6235
- [x] #6317 
- [x] #6331
- [x] #6326
- [x] #6332
- [x] #6347
- [x] #6348
- [x] #6337
- [x] #6355
- [x] #6354
- [x] #6322
- [x] #6353
- [x] #6359
- [x] #6364
- [x] #6363
- [x] [FIL BATCH_TREE_REORG fix for SM90, 100 and
120](a3e419a)

---------

Co-authored-by: William Hicks <whicks@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Cython / Python Cython or Python issue non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants