Create a nearest neighbor searcher object for efficient nearest neighbor search. Uses Rnanoflann (exact Euclidean search) by default, or RcppHNSW (approximate search with cosine/inner-product support) when those distance metrics are requested.
Arguments
- X
A numeric matrix where each row represents a data point.
- labels
A vector of labels corresponding to each row in X. Defaults to row indices.
- ...
Additional arguments (currently unused).
- distance
The distance metric to use. One of "l2", "euclidean", "cosine", or "ip". Note: "cosine" and "ip" require the RcppHNSW package.
- M
The maximum number of connections for HNSW (only used with cosine/ip).
- ef
The size of the dynamic candidate list for HNSW (only used with cosine/ip).