knn | R Documentation |
Adapted K nearest neighbors based on RcppHNSW
knn( query, ref, k, distance = "euclidean", same = FALSE, threads = 1L, verbose = FALSE, progress = FALSE, ... )
query |
A |
ref |
A |
k |
An |
distance |
Type of distance to calculate. |
same |
Logic. If |
threads |
An |
verbose |
If TRUE, log messages to the console. |
progress |
If TRUE, log a progress bar when |
... |
Arguments passed to |
This function is based on hnswlib C++ library (Malkov & Yashunin 2016) and
its bindings for R (RcppHNSW; Melville 2020) for a fast estimation of neighbors
points. It is adapted to simplify the workflow within rTLS.
If you use this function, please consider cite the C++ library and
RcppHNSW
package.
A data.table
with three columns describing the indices of the query, ref, and k neighbors and the distances.
J. Antonio Guzmán Q.
Malkov, Y. A., & Yashunin, D. A. (2016). Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs. arXiv preprint arXiv:1603.09320.
radius_search
#Point cloud data("pc_tree") #knn search using k = 3 knn(pc_tree, pc_tree, k = 3, same = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.