Skip to content

[FEA] Enable UMAP to build knn graph using NN Descent - #5910

Merged
rapids-bot[bot] merged 55 commits into
NVIDIA:branch-24.08from
jinsolp:add-umap-nndescent
Jul 31, 2024
Merged

rapids-bot[bot] merged 55 commits into
NVIDIA:branch-24.08from
jinsolp:add-umap-nndescent

Conversation

@jinsolp

@jinsolp jinsolp commented Jun 1, 2024 •

Copy link
Copy Markdown
Contributor

Description

  1. Adds build_algo=nn_descent option to UMAP.

Now user can choose the knn graph build algorithm between "brute_force_knn" and "nn_descent"
Defaults to "auto", in which case decides to run with brute force knn or nn descent depending on the given dataset size.

"auto" decides to run with brute_force_knn if either 1) data has <= 50K rows OR 2) data is sparse. Otherwise decides to run with nn_descent.

50K rows roughly chosen based on grid search below. (runtime in ms) - Discussed with Corey
Screenshot 2024-07-23 at 5 36 34 PM

X_embedded_nnd = cuUMAP(n_neighbors=16, build_algo="nn_descent").fit_transform(data)
score_nnd = cuml.metrics.trustworthiness(data, X_embedded_nnd)
  1. Adds data_on_host option (defaults to False) when calling fit() or fit_transform()

Note that brute force knn cannot be used with data on host

Running Benchmarks

Screenshot 2024-07-23 at 5 41 19 PM

@jinsolp
jinsolp requested review from a team as code owners June 1, 2024 00:34
@github-actions github-actions Bot added Cython / Python Cython or Python issue CUDA/C++ labels Jun 1, 2024
@jinsolp

jinsolp commented Jun 1, 2024

Copy link
Copy Markdown
Contributor Author

Oh the check is failing because we need the updated implementation of RAFT NN Descent (linked above)...!

@viclafargue viclafargue left a comment

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.

Great work! Just have a few suggestions. Also, it could be great to add this feature to the simplicial set functions. But, we could do that in another PR too.

Comment thread cpp/src/umap/knn_graph/algo.cuh Resolved
Comment thread cpp/src/umap/knn_graph/algo.cuh Resolved
Comment thread python/cuml/manifold/umap.pyx Resolved
@jinsolp

jinsolp commented Jul 26, 2024

Copy link
Copy Markdown
Contributor Author

Added warning and linked issue for consistency with previous version

@jinsolp
jinsolp requested a review from divyegala July 29, 2024 19:26
@dantegd dantegd added feature request New feature or request non-breaking Non-breaking change labels Jul 30, 2024
@dantegd

dantegd commented Jul 30, 2024

Copy link
Copy Markdown
Contributor

/ok to test

@dantegd

dantegd commented Jul 30, 2024

Copy link
Copy Markdown
Contributor

/ok to test

@dantegd

dantegd commented Jul 30, 2024

Copy link
Copy Markdown
Contributor

/ok to test

@divyegala

Copy link
Copy Markdown
Contributor

/ok to test

@dantegd

dantegd commented Jul 30, 2024

Copy link
Copy Markdown
Contributor

/merge

@divyegala

Copy link
Copy Markdown
Contributor

/ok to test

@divyegala

Copy link
Copy Markdown
Contributor

/ok to test

@divyegala

Copy link
Copy Markdown
Contributor

/ok to test

@dantegd

dantegd commented Jul 31, 2024

Copy link
Copy Markdown
Contributor

/merge

@rapids-bot
rapids-bot Bot merged commit 50d1a74 into NVIDIA:branch-24.08 Jul 31, 2024
@jinsolp
jinsolp deleted the add-umap-nndescent branch July 31, 2024 16:19
loulankxh pushed a commit to loulankxh/raft that referenced this pull request Oct 14, 2025
Adding distance epilogue to NN Descent.
Planning to use them for the following use cases as of now;
- Calculating mutual reachability distance for HDBSCAN (possibly for usage with HDBSCAN - [related PR here](NVIDIA/cuml#5939))
- Enabling `L2SqrtExpanded` distance metric, by `sqrt`-ing the current supported metric (`L2Expanded`) of NN Descent in the distance epilogue. (for usage with UMAP - [related PR here](NVIDIA/cuml#5910))

Authors:
  - Jinsol Park (https://github.com/jinsolp)

Approvers:
  - Tarang Jain (https://github.com/tarang-jain)
  - Tamas Bela Feher (https://github.com/tfeher)
  - Divye Gala (https://github.com/divyegala)

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

Labels

CUDA/C++ Cython / Python Cython or Python issue feature request New feature or request non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants