Inverted file over k-means Voronoi cells. Cheap to build and easy to tune:
nlist sets how finely the space is cut, nprobe how many cells a query
visits. The smallest of the unquantised approximate indices. No Manhattan.
References
Sivic J, Zisserman A (2003). Video Google: a text retrieval approach to object matching in videos. Proceedings Ninth IEEE International Conference on Computer Vision, 1470-1477. doi:10.1109/ICCV.2003.1238663
Jégou H, Douze M, Schmid C (2011). Product quantization for nearest neighbor search. IEEE Transactions on Pattern Analysis and Machine Intelligence, 33, 117-128. doi:10.1109/TPAMI.2010.57
Super class
AnnIndex -> IvfIndex
Methods
Inherited methods
IvfIndex$new()
Build the index.
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").nlistInteger or
NULL. Number of Voronoi cells.NULLusessqrt(n).nprobeInteger or
NULL. Cells visited per query.NULLusessqrt(nlist). Can be changed after the build.kmeans_itersInteger or
NULL. Lloyd iterations.NULLuses 30.kmeans_balancedBoolean. Reseed starved centroids each iteration.
seedInteger. Fixes the k-means initialisation.
precisionString.
"float"stores the data as f32,"double"as f64..verboseBoolean. Print build progress from Rust.
Examples
x <- generate_clustered_data(1000L, 16L)$data
idx <- IvfIndex$new(x)
idx$nprobe <- 10L
res <- idx$predict(x[1:5, ], k = 10L)
