pub struct IvfClusterStats {
pub n_clusters: usize,
pub cluster_sizes: Vec<usize>,
pub avg_size: f32,
pub size_variance: f32,
}Expand description
Diagnostic snapshot of inverted-list occupancy.
Returned by crate::IvfIndex::cluster_stats after the index has
been trained and (typically) populated. Before training the
cluster_sizes slice is empty and avg_size / size_variance
are 0.0.
§Examples
use iqdb_ivf::IvfClusterStats;
// Synthetic example — IvfIndex::cluster_stats returns the real one.
let stats = IvfClusterStats {
n_clusters: 4,
cluster_sizes: vec![3, 3, 4, 2],
avg_size: 3.0,
size_variance: 0.5,
};
assert_eq!(stats.cluster_sizes.iter().sum::<usize>(), 12);Fields§
§n_clusters: usizeNumber of partitions the index was configured with.
Echoed from crate::IvfConfig::n_clusters so a caller does
not need to also carry the config to interpret the snapshot.
cluster_sizes: Vec<usize>Live vector count per cluster, indexed by cluster id.
Always either empty (before training) or of length
Self::n_clusters. A cluster size of 0 is meaningful and
is what motivates retrain() work in a follow-up.
avg_size: f32Arithmetic mean of Self::cluster_sizes as f32.
0.0 when Self::cluster_sizes is empty.
size_variance: f32Population variance of Self::cluster_sizes as f32.
0.0 when Self::cluster_sizes is empty. Higher values
signal cluster imbalance.
Trait Implementations§
Source§impl Clone for IvfClusterStats
impl Clone for IvfClusterStats
Source§fn clone(&self) -> IvfClusterStats
fn clone(&self) -> IvfClusterStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IvfClusterStats
impl Debug for IvfClusterStats
Source§impl PartialEq for IvfClusterStats
impl PartialEq for IvfClusterStats
Source§fn eq(&self, other: &IvfClusterStats) -> bool
fn eq(&self, other: &IvfClusterStats) -> bool
self and other values to be equal, and is used by ==.