pub struct IvfConfig {
pub n_list: usize,
pub nprobe: usize,
pub training_sample_size: usize,
pub kmeans_iters: usize,
pub seed: Option<u64>,
}Expand description
Configuration for an IVF (Inverted File) index.
IVF partitions the vector space into n_list Voronoi cells via k-means.
At query time, only the nprobe cells closest to the query are searched,
making search cost roughly O(n_list + nprobe * N / n_list) instead of
O(N). Higher nprobe yields higher recall at the cost of latency.
Defaults follow the FAISS convention of n_list ≈ sqrt(N) and
nprobe = n_list / 16 for a ~0.95 recall@10 starting point.
Fields§
§n_list: usizeNumber of Voronoi cells (centroids).
nprobe: usizeNumber of cells to probe per query.
training_sample_size: usizeUpper bound on training-sample size used by k-means. The effective
sample is min(training_sample_size, input.len()).
kmeans_iters: usizeMaximum Lloyd iterations during training.
seed: Option<u64>Random seed for k-means++ initialisation. None ⇒ non-deterministic.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for IvfConfig
impl<'de> Deserialize<'de> for IvfConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for IvfConfig
impl RefUnwindSafe for IvfConfig
impl Send for IvfConfig
impl Sync for IvfConfig
impl Unpin for IvfConfig
impl UnsafeUnpin for IvfConfig
impl UnwindSafe for IvfConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more