Residual vector quantization (RVQ)
Residual vector quantization (RVQ) is an non-orthogonal MCQ method.
RVQ iteratively runs $k$-means to learn full-dimensional codebooks
Rayuela.quantize_rvq โ Function.quantize_rvq(X, C, V=false) -> B, singletonsGiven data and full-dimensional codebooks, quantize.
Arguments
X::Matrix{T}:d-by-ndata to quantizeC::Vector{Matrix{T}}:m-long vector withd-by-hmatrix entries. Each matrix is a codebook.V::Bool: Whether to print progress
Returns
B::Matrix{Int16}:m-by-ncodes that approximateXsingletons::Vector{Matrix{T}}:mmatrices with unused codebook entries
Rayuela.train_rvq โ Function.train_rvq(X, m, h, niter=25, V=false) -> C, B, errorTrain a residual quantizer.
Arguments
X::Matrix{T}:d-by-ndata to quantizem::Integer: Number of codebooksh::Integer: Number of entries in each codebook (typically 256)niter::Integer: Number of iterations to useV::Bool: Whether to print progress
Returns
C::Vector{Matrix{T}}:m-long vector withd-by-hmatrix entries. Each matrix is a codebook of size approximatelyd/m-by-h.B::Matrix{Int16}:m-by-nmatrix with the codeserror::T: The quantization error after training
Reference
Chen, Y., Guan, T., & Wang, C. (2010). Approximate nearest neighbor search by residual vector quantization. Sensors, 10(12), 11259-11273. [PDF]