buildIndex | R Documentation |
Build indices for nearest-neighbor searching with different algorithms.
buildIndex(X, transposed = FALSE, ..., BNPARAM = NULL)
X |
A numeric matrix where rows correspond to data points and columns correspond to variables (i.e., dimensions). |
transposed |
Logical scalar indicating whether |
... |
Further arguments to be passed to individual methods. |
BNPARAM |
A BiocNeighborParam object specifying the type of index to be constructed.
If Alternatively, this may be an external pointer constructed by |
The type and structure of the index object returned by buildIndex
methods is arbitrary and left to the discretion of the method developer.
However, there are a few constraints:
It should not be a matrix, as this interferes with dispatch for methods like findKNN
when X
is just the data matrix.
If it is an external pointer, it should refer to a BiocNeighbors::Prebuilt
object
(see definition in system.file("include", "BiocNeighbors.h", package="BiocNeighbors")
).
This allows it to be directly used in methods like findKNN
.
A prebuilt index that can be used in findKNN
and related functions as the X=
argument.
The exact type of the index is not defined, but users should assume that the index is not serializable, i.e., cannot be saved or transferred between processes.
Aaron Lun
Y <- matrix(rnorm(100000), ncol=20)
(k.out <- buildIndex(Y))
(a.out <- buildIndex(Y, BNPARAM=AnnoyParam()))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.