Skip to content

[DOC] Add missing parameters to UMAP and NearestNeighbors docstrings#7632

Merged
rapids-bot[bot] merged 15 commits intorapidsai:mainfrom
silasmue:pull-request/6211
Feb 10, 2026
Merged

[DOC] Add missing parameters to UMAP and NearestNeighbors docstrings#7632
rapids-bot[bot] merged 15 commits intorapidsai:mainfrom
silasmue:pull-request/6211

Conversation

@silasmue
Copy link
Copy Markdown
Contributor

Related issue: Issue #6211

I added the requested documentation for UMAP and Nearest Neighbor.

UMAP: Added documentation for the parameters target_n_neighbors, target_weight, target_metric. Except for some typos I took the documentation from umap-learn.

Nearest Neighbor: I added the supported metrics as requested in the #6211 issue, and double checked them with the code if they are supported.

This is my first contribution, if everything is okay I would look into another issue.

@silasmue silasmue requested a review from a team as a code owner December 29, 2025 17:01
@silasmue silasmue requested a review from dantegd December 29, 2025 17:01
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Dec 29, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Dec 29, 2025
@silasmue
Copy link
Copy Markdown
Contributor Author

I think the DOC label is missing, I can not change the label myself.

@jinsolp jinsolp added the doc Documentation label Jan 9, 2026
@silasmue
Copy link
Copy Markdown
Contributor Author

Thanks for adding the doc label. I think the last step to run the pipeline successful is to mark the change as non-breaking because it's just an improvement in the documentation.

@csadorf csadorf added the non-breaking Non-breaking change label Jan 12, 2026
@csadorf
Copy link
Copy Markdown
Contributor

csadorf commented Jan 12, 2026

Please rebase this PR and target the main branch.

Copy link
Copy Markdown
Contributor

@jinsolp jinsolp left a comment

Choose a reason for hiding this comment

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

Thank you for your work! Added a minor suggestion.

Comment thread python/cuml/cuml/manifold/umap.pyx Outdated
Comment on lines +237 to +238
(e.g. for a regression problem) then metric of 'l1' or 'l2' is
probably more appropriate.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
(e.g. for a regression problem) then metric of 'l1' or 'l2' is
probably more appropriate.
(e.g. for a regression problem) then metric of 'euclidean' or 'l2' is
probably more appropriate.

Suggesting small fix because our supported target metrics are defined as below;

_TARGET_METRICS = {
    "euclidean": lib.MetricType.EUCLIDEAN,
    "l2": lib.MetricType.EUCLIDEAN,
    "categorical": lib.MetricType.CATEGORICAL,
}

Silas Müller added 2 commits January 15, 2026 12:51
…arget_n_neighbors, target_weight, target_metric) and Nearest Neighbors, for NN I added sqeuclidean, inner_product, jaccard, hellinger, haversine for the metric, because according to the code it is supported.

;

added parameter documentation.
@csadorf csadorf requested review from a team as code owners January 15, 2026 18:54
@csadorf csadorf changed the base branch from branch-25.10 to main January 15, 2026 18:54
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@csadorf
Copy link
Copy Markdown
Contributor

csadorf commented Jan 15, 2026

Please rebase this PR and target the main branch.

I've rebased the branch and updated the PR target branch.

@csadorf csadorf removed request for a team, dantegd and msarahan January 15, 2026 20:04
@csadorf
Copy link
Copy Markdown
Contributor

csadorf commented Feb 4, 2026

/ok to test c9caf7f

@csadorf
Copy link
Copy Markdown
Contributor

csadorf commented Feb 4, 2026

Is there something missing. I would search for another small issue I could solve now, if there are any changes, improvements or suggestions just let me know.

No, this should be good to go. We just need to get a good CI run.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 4, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • UMAP adds three user-facing tuning options for targeted embeddings: target_n_neighbors, target_weight, and target_metric, enabling finer control over neighborhood size, influence, and similarity handling.
  • Documentation

    • Nearest neighbors documentation expanded with a comprehensive list of supported distance metrics and clearer compatibility notes for different algorithms and input types.

Walkthrough

UMAP gains three public parameters—target_n_neighbors, target_metric, and target_weight—added to the constructor, class parameter listing, and wired through init_params, _params_from_cpu, and _params_to_cpu. NearestNeighbors docstring expanded to list additional supported metrics and clarify algorithm/sparse-input compatibility.

Changes

Cohort / File(s) Summary
UMAP Parameter Additions
python/cuml/cuml/manifold/umap/umap.pyx
Introduced target_n_neighbors, target_metric, and target_weight in UMAP.__init__, added them to _get_param_names(), and propagated through init_params, _params_from_cpu, and _params_to_cpu for parameter mapping and (de)serialization. Review wiring in init/param conversion paths.
NearestNeighbors Metric Documentation
python/cuml/cuml/neighbors/nearest_neighbors.pyx
Expanded metric parameter docstring to enumerate many supported metrics (l1, manhattan, euclidean, sqeuclidean, lp, linf, cosine, jaccard, hellinger, haversine, etc.) and updated per-algorithm and sparse-input compatibility notes. No logic changes; review doc accuracy and wording.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding missing parameter documentation to UMAP and NearestNeighbors docstrings.
Description check ✅ Passed The description clearly relates to the changeset, explaining the documentation additions for UMAP parameters and NearestNeighbors metrics with references to the related issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@python/cuml/cuml/neighbors/nearest_neighbors.pyx`:
- Around line 475-488: The docstring for metric in nearest_neighbors.pyx has a
missing opening quote before correlation in the metric list causing a mismatched
quote; update the metric string list (in the nearest_neighbors.pyx docstring
block where "metric : string..." is defined) to add the missing leading quote so
that 'correlation' is properly quoted and the sentence reads "'jensenshannon',
'cosine', 'braycurtis', 'jaccard', 'hellinger', 'correlation', 'inner_product'."

Comment thread python/cuml/cuml/neighbors/nearest_neighbors.pyx
@csadorf
Copy link
Copy Markdown
Contributor

csadorf commented Feb 4, 2026

/ok to test cce3ed2

@silasmue
Copy link
Copy Markdown
Contributor Author

silasmue commented Feb 5, 2026

@csadorf okay nice. I will take a closer look on the weekend if the CI is not working until then.

@csadorf
Copy link
Copy Markdown
Contributor

csadorf commented Feb 5, 2026

/ok to test 0fc5965

@betatim betatim mentioned this pull request Feb 5, 2026
rapids-bot Bot pushed a commit that referenced this pull request Feb 5, 2026
I think what happened is that #7751 fixed something that used to lead to the `check_do_not_raise_errors_in_init_or_set_params` check failing. The reason we ended up seeing it in #7632 is that #7751 was merged before #7753 (and we didnt rerun the CI for that PR).

Authors:
  - Tim Head (https://github.com/betatim)

Approvers:
  - Jim Crist-Harif (https://github.com/jcrist)
  - Simon Adorf (https://github.com/csadorf)

URL: #7768
@csadorf
Copy link
Copy Markdown
Contributor

csadorf commented Feb 6, 2026

/ok to test 6ed6b51

@csadorf
Copy link
Copy Markdown
Contributor

csadorf commented Feb 10, 2026

/merge

@rapids-bot rapids-bot Bot merged commit ad95a73 into rapidsai:main Feb 10, 2026
89 checks passed
dantegd added a commit to dantegd/cuml that referenced this pull request Feb 17, 2026
I think what happened is that rapidsai#7751 fixed something that used to lead to the `check_do_not_raise_errors_in_init_or_set_params` check failing. The reason we ended up seeing it in rapidsai#7632 is that rapidsai#7751 was merged before rapidsai#7753 (and we didnt rerun the CI for that PR).

Authors:
  - Tim Head (https://github.com/betatim)

Approvers:
  - Jim Crist-Harif (https://github.com/jcrist)
  - Simon Adorf (https://github.com/csadorf)

URL: rapidsai#7768
dantegd added a commit to dantegd/cuml that referenced this pull request Feb 17, 2026
…apidsai#7632)

**Related issue:** Issue rapidsai#6211

I added the requested documentation for UMAP and Nearest Neighbor.

**UMAP:** Added documentation for the parameters `target_n_neighbors`, `target_weight`, `target_metric`. Except for some typos I took the documentation from umap-learn.

**Nearest Neighbor:** I added the supported `metrics` as requested in the rapidsai#6211 issue, and double checked them with the code if they are supported.

This is my first contribution, if everything is okay I would look into another issue.

Authors:
  - Silas Müller (https://github.com/silasmue)
  - Simon Adorf (https://github.com/csadorf)

Approvers:
  - Simon Adorf (https://github.com/csadorf)
  - Jinsol Park (https://github.com/jinsolp)

URL: rapidsai#7632
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cython / Python Cython or Python issue doc Documentation non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants