knn {destiny} | R Documentation |
k nearest neighbor search with custom distance function.
find_knn(data, k, ..., query = NULL, distance = c("euclidean", "cosine", "rankcor"), sym = TRUE)
data |
Data matrix |
k |
Number of nearest neighbors |
... |
All parameters after this have to be specified by name |
query |
Query matrix. In |
distance |
Distance metric to use. Allowed measures: Euclidean distance (default), cosine distance (1-corr(c_1, c_2)) or rank correlation distance (1-corr(rank(c_1), rank(c_2))) |
sym |
Return a symmetric matrix (as long as query is NULL)? |
A dgCMatrix
if sym == TRUE
, else a dsCMatrix
(nrow(query) \times nrow(data)).