This implementation uses a randomization scheme and thus produces results that are nondeterministic and only approximately correct. The algorithm is roughly inspired by Dong et al, but there are differences. This is a rough implementation and improvements are possible.
knn.from.data(dT, k, metric.function, subsample.k = 0.5,
fix.observations = NULL)
matrix with data (observations in columns, features in rows)
integer, number of neighbors
function that returns a metric distance
numeric, used for internal tuning of implementation
integer, number of observations in dT that will appear in knn
list with two components; indexes - identifies, for each point in dataset, the set of k neighbors distances - provides distances from each point to those neighbors num.computed - for diagnostics only, gives the number of distances computed internally avg.