The flat graph from DiskANN: out-degree r, pruned in two passes with the
relaxed-neighbour rule. Builds slower than HnswIndex at its cheapest
setting, though the gap closes once you match on recall, and the index is a
few per cent smaller.
References
Jayaram Subramanya S, et al. (2019). DiskANN: fast accurate billion-point nearest neighbor search on a single node. Advances in Neural Information Processing Systems, 32. https://papers.nips.cc/paper/2019/hash/09853c7fb1d3f8ee67a61b6bf4a7f8e6-Abstract.html
Super class
AnnIndex -> VamanaIndex
Methods
Inherited methods
VamanaIndex$new()
Build the index.
Usage
VamanaIndex$new(
data,
metric = c("euclidean", "sqeuclidean", "cosine", "manhattan"),
r = 48L,
l_build = 100L,
alpha_pass1 = 1,
alpha_pass2 = 1.2,
ef_search = NULL,
seed = 42L,
precision = c("float", "double"),
.verbose = FALSE
)Arguments
dataNumeric matrix or data.frame. Samples x features. An index pointer is also accepted;
load_ann_index()uses that path.metricString. One of
c("euclidean", "sqeuclidean", "cosine", "manhattan").rInteger. Maximum out-degree.
l_buildInteger. Candidate list width during the build.
alpha_pass1Numeric. Relaxed-neighbour factor on the first pruning pass.
1is the plain rule.alpha_pass2Numeric. Same on the second pass. Above 1 keeps longer edges, which keeps the graph navigable from far away.
ef_searchInteger or
NULL. Beam width at query time.NULLuses 75. Can be changed after the build.seedInteger. Fixes the entry point and pruning order.
precisionString.
"float"stores the data as f32,"double"as f64..verboseBoolean or integer. Build progress from Rust:
0orFALSEsilent,1orTRUEprogress,2adds timed build stages.
Examples
x <- generate_clustered_data(1000L, 16L)$data
idx <- VamanaIndex$new(x)
res <- idx$predict(x[1:5, ], k = 10L)
