Fork me on GitHub

src/arraymancer/spatial/neighbors

Search:
Group by:
  Source Edit

Procs

proc nearestNeighbors[T](X: Tensor[T]; eps: float; metric: typedesc[AnyMetric];
                         p = 2.0; useNaiveNearestNeighbor: static bool = false): seq[
    Tensor[int]]

Computes nearest neighbors of all points in X that are within a distance of eps under the given metric.

The input tensor X must be of rank 2 and contain data as:

  • [n_observations, n_dimensions]

If the Minkowski metric is used p corresponds to the power used for the metric.

If useNaiveNearestNeighbor is set to true a naive nearest neighbor computation is performed. This is not advised, as it is significantly slower than the default approach using a k-d tree.

  Source Edit
Arraymancer Technical reference Tutorial Spellbook (How-To's) Under the hood