|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2023-2024, NVIDIA CORPORATION. |
| 2 | + * Copyright (c) 2023-2025, NVIDIA CORPORATION. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -37,26 +37,24 @@ namespace cuvs::neighbors::nn_descent {
|
37 | 37 |
|
38 | 38 | /**
|
39 | 39 | * @brief Parameters used to build an nn-descent index
|
40 |
| - * |
41 |
| - * `graph_degree`: For an input dataset of dimensions (N, D), |
| 40 | + * - `graph_degree`: For an input dataset of dimensions (N, D), |
42 | 41 | * determines the final dimensions of the all-neighbors knn graph
|
43 | 42 | * which turns out to be of dimensions (N, graph_degree)
|
44 |
| - * `intermediate_graph_degree`: Internally, nn-descent builds an |
| 43 | + * - `intermediate_graph_degree`: Internally, nn-descent builds an |
45 | 44 | * all-neighbors knn graph of dimensions (N, intermediate_graph_degree)
|
46 | 45 | * before selecting the final `graph_degree` neighbors. It's recommended
|
47 | 46 | * that `intermediate_graph_degree` >= 1.5 * graph_degree
|
48 |
| - * `max_iterations`: The number of iterations that nn-descent will refine |
| 47 | + * - `max_iterations`: The number of iterations that nn-descent will refine |
49 | 48 | * the graph for. More iterations produce a better quality graph at cost of performance
|
50 |
| - * `termination_threshold`: The delta at which nn-descent will terminate its iterations |
51 |
| - * |
| 49 | + * - `termination_threshold`: The delta at which nn-descent will terminate its iterations |
| 50 | + * - `return_distances`: Boolean to decide whether to return distances array |
52 | 51 | */
|
53 | 52 | struct index_params : cuvs::neighbors::index_params {
|
54 |
| - size_t graph_degree = 64; // Degree of output graph. |
55 |
| - size_t intermediate_graph_degree = 128; // Degree of input graph for pruning. |
56 |
| - size_t max_iterations = 20; // Number of nn-descent iterations. |
57 |
| - float termination_threshold = 0.0001; // Termination threshold of nn-descent. |
58 |
| - bool return_distances = true; // return distances if true |
59 |
| - size_t n_clusters = 1; // defaults to not using any batching |
| 53 | + size_t graph_degree = 64; |
| 54 | + size_t intermediate_graph_degree = 128; |
| 55 | + size_t max_iterations = 20; |
| 56 | + float termination_threshold = 0.0001; |
| 57 | + bool return_distances = true; |
60 | 58 |
|
61 | 59 | /** @brief Construct NN descent parameters for a specific kNN graph degree
|
62 | 60 | *
|
@@ -211,7 +209,10 @@ struct index : cuvs::neighbors::index {
|
211 | 209 | * @brief Build nn-descent Index with dataset in device memory
|
212 | 210 | *
|
213 | 211 | * The following distance metrics are supported:
|
214 |
| - * - L2 |
| 212 | + * - L2Expanded |
| 213 | + * - L2SqrtExpanded |
| 214 | + * - CosineExpanded |
| 215 | + * - InnerProduct |
215 | 216 | *
|
216 | 217 | * Usage example:
|
217 | 218 | * @code{.cpp}
|
@@ -244,7 +245,10 @@ auto build(raft::resources const& res,
|
244 | 245 | * @brief Build nn-descent Index with dataset in host memory
|
245 | 246 | *
|
246 | 247 | * The following distance metrics are supported:
|
247 |
| - * - L2 |
| 248 | + * - L2Expanded |
| 249 | + * - L2SqrtExpanded |
| 250 | + * - CosineExpanded |
| 251 | + * - InnerProduct |
248 | 252 | *
|
249 | 253 | * Usage example:
|
250 | 254 | * @code{.cpp}
|
@@ -279,7 +283,10 @@ auto build(raft::resources const& res,
|
279 | 283 | * @brief Build nn-descent Index with dataset in device memory
|
280 | 284 | *
|
281 | 285 | * The following distance metrics are supported:
|
282 |
| - * - L2 |
| 286 | + * - L2Expanded |
| 287 | + * - L2SqrtExpanded |
| 288 | + * - CosineExpanded |
| 289 | + * - InnerProduct |
283 | 290 | *
|
284 | 291 | * Usage example:
|
285 | 292 | * @code{.cpp}
|
@@ -312,7 +319,10 @@ auto build(raft::resources const& res,
|
312 | 319 | * @brief Build nn-descent Index with dataset in host memory
|
313 | 320 | *
|
314 | 321 | * The following distance metrics are supported:
|
315 |
| - * - L2 |
| 322 | + * - L2Expanded |
| 323 | + * - L2SqrtExpanded |
| 324 | + * - CosineExpanded |
| 325 | + * - InnerProduct |
316 | 326 | *
|
317 | 327 | * Usage example:
|
318 | 328 | * @code{.cpp}
|
@@ -347,7 +357,11 @@ auto build(raft::resources const& res,
|
347 | 357 | * @brief Build nn-descent Index with dataset in device memory
|
348 | 358 | *
|
349 | 359 | * The following distance metrics are supported:
|
350 |
| - * - L2 |
| 360 | + * - L2Expanded |
| 361 | + * - L2SqrtExpanded |
| 362 | + * - CosineExpanded |
| 363 | + * - InnerProduct |
| 364 | + * - BitwiseHamming |
351 | 365 | *
|
352 | 366 | * Usage example:
|
353 | 367 | * @code{.cpp}
|
@@ -380,7 +394,11 @@ auto build(raft::resources const& res,
|
380 | 394 | * @brief Build nn-descent Index with dataset in host memory
|
381 | 395 | *
|
382 | 396 | * The following distance metrics are supported:
|
383 |
| - * - L2 |
| 397 | + * - L2Expanded |
| 398 | + * - L2SqrtExpanded |
| 399 | + * - CosineExpanded |
| 400 | + * - InnerProduct |
| 401 | + * - BitwiseHamming |
384 | 402 | *
|
385 | 403 | * Usage example:
|
386 | 404 | * @code{.cpp}
|
@@ -415,7 +433,11 @@ auto build(raft::resources const& res,
|
415 | 433 | * @brief Build nn-descent Index with dataset in device memory
|
416 | 434 | *
|
417 | 435 | * The following distance metrics are supported:
|
418 |
| - * - L2 |
| 436 | + * - L2Expanded |
| 437 | + * - L2SqrtExpanded |
| 438 | + * - CosineExpanded |
| 439 | + * - InnerProduct |
| 440 | + * - BitwiseHamming |
419 | 441 | *
|
420 | 442 | * Usage example:
|
421 | 443 | * @code{.cpp}
|
@@ -448,7 +470,11 @@ auto build(raft::resources const& res,
|
448 | 470 | * @brief Build nn-descent Index with dataset in host memory
|
449 | 471 | *
|
450 | 472 | * The following distance metrics are supported:
|
451 |
| - * - L2 |
| 473 | + * - L2Expanded |
| 474 | + * - L2SqrtExpanded |
| 475 | + * - CosineExpanded |
| 476 | + * - InnerProduct |
| 477 | + * - BitwiseHamming |
452 | 478 | *
|
453 | 479 | * Usage example:
|
454 | 480 | * @code{.cpp}
|
@@ -479,6 +505,7 @@ auto build(raft::resources const& res,
|
479 | 505 | std::optional<raft::host_matrix_view<uint32_t, int64_t, raft::row_major>> graph =
|
480 | 506 | std::nullopt) -> cuvs::neighbors::nn_descent::index<uint32_t>;
|
481 | 507 |
|
| 508 | +/** @} */ |
482 | 509 | /**
|
483 | 510 | * @brief Test if we have enough GPU memory to run NN descent algorithm.
|
484 | 511 | *
|
|
0 commit comments