merge_knn  R Documentation 
merge_knn
takes a list of nearest neighbor graphs and merges them into a
single graph, with the same number of neighbors as the first graph. This is
useful to combine the results of multiple different nearest neighbor
searches: the output will be at least as accurate as the most accurate of the
two input graphs, and ideally will be more accurate than either.
merge_knn(graphs, is_query = FALSE, n_threads = 0, verbose = FALSE)
graphs 
A list of nearest neighbor graphs to merge. Each item in the list should consist of a sublist containing:

is_query 
If 
n_threads 
Number of threads to use. 
verbose 
If 
a list containing:
idx
an n by k matrix containing the merged nearest neighbor indices.
dist
an n by k matrix containing the merged nearest neighbor distances.
The size of k
in the output graph is the same as that of the first
item in nn_graphs
.
set.seed(1337)
# Nearest neighbor descent with 15 neighbors for iris three times,
# starting from a different random initialization each time
iris_rnn1 < nnd_knn(iris, k = 15, n_iters = 1)
iris_rnn2 < nnd_knn(iris, k = 15, n_iters = 1)
iris_rnn3 < nnd_knn(iris, k = 15, n_iters = 1)
# Merged results should be an improvement over individual results
iris_mnn < merge_knn(list(iris_rnn1, iris_rnn2, iris_rnn3))
sum(iris_mnn$dist) < sum(iris_rnn1$dist)
sum(iris_mnn$dist) < sum(iris_rnn2$dist)
sum(iris_mnn$dist) < sum(iris_rnn3$dist)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.