buildIndex: Build a nearest-neighbor index

buildIndexR Documentation

Build a nearest-neighbor index

Description

Build indices for nearest-neighbor searching with different algorithms.

Usage

buildIndex(X, transposed = FALSE, ..., BNPARAM = NULL)

Arguments

X

A numeric matrix where rows correspond to data points and columns correspond to variables (i.e., dimensions).

transposed

Logical scalar indicating whether X is transposed, i.e., rows are variables and columns are data points.

...

Further arguments to be passed to individual methods.

BNPARAM

A BiocNeighborParam object specifying the type of index to be constructed. If NULL, this defaults to a KmknnParam object.

Alternatively, this may be a list returned by defineBuilder.

Details

Each buildIndex method is expected to return an instance of a BiocNeighborIndex subclass. The structure of this subclass is arbitrary and left to the discretion of the method developer. Developers are also responsible for defining methods for their subclass in each of the relevant functions (e.g., findKNN, queryKNN). The exception is if the method returns an instance of a BiocNeighborGenericIndex subclass, which can be used with the existing methods for findKNN, etc. without further effort.

Value

A BiocNeighborIndex object can be used in findKNN and related functions as the X= argument. Users should assume that the index is not serializable, i.e., cannot be saved or transferred between processes.

Author(s)

Aaron Lun

Examples

Y <- matrix(rnorm(100000), ncol=20)
(k.out <- buildIndex(Y))
(a.out <- buildIndex(Y, BNPARAM=AnnoyParam()))


LTLA/kmknn documentation built on Oct. 18, 2024, 9:01 p.m.