Build an Annoy index from a bigmemory::big.matrix
Source: R/annoy_interface.R
annoy_build_bigmatrix.RdStream the rows of a reference bigmemory::big.matrix into an on-disk
Annoy index and write a small sidecar metadata file next to it. The returned
bigannoy_index can be reopened later with annoy_open_index().
Usage
annoy_build_bigmatrix(
x,
path,
n_trees = 50L,
metric = "euclidean",
seed = NULL,
build_threads = -1L,
block_size = annoy_default_block_size(),
metadata_path = NULL,
load_mode = "lazy"
)Arguments
- x
A
bigmemory::big.matrixor an external pointer referencing the reference matrix.- path
File path where the Annoy index should be written.
- n_trees
Number of Annoy trees to build.
- metric
Distance metric. bigANNOY v2 supports
"euclidean","angular","manhattan", and"dot".- seed
Optional positive integer seed used to initialize Annoy's build RNG.
- build_threads
Build-thread setting passed to Annoy's native backend. Use
-1Lfor Annoy's default.- block_size
Number of rows processed per streamed block while building the index.
- metadata_path
Optional path for the sidecar metadata file. Defaults to
paste0(path, ".meta").- load_mode
Whether to keep the returned index metadata-only until first search (
"lazy") or eagerly load a live index handle immediately ("eager").