pub struct Clustering { /* private fields */ }Expand description
The clustering algorithm.
Implementations§
Source§impl Clustering
impl Clustering
Sourcepub fn new(d: u32, k: u32) -> Result<Self>
pub fn new(d: u32, k: u32) -> Result<Self>
Obtain a new clustering object with the given dimensionality
d and number of centroids k.
Sourcepub fn new_with_params(
d: u32,
k: u32,
params: &ClusteringParameters,
) -> Result<Self>
pub fn new_with_params( d: u32, k: u32, params: &ClusteringParameters, ) -> Result<Self>
Obtain a new clustering object, with the given clustering parameters.
Sourcepub fn train<I>(&mut self, x: &[f32], index: &mut I) -> Result<()>
pub fn train<I>(&mut self, x: &[f32], index: &mut I) -> Result<()>
Perform the clustering algorithm with the given data and index. The index is used during the assignment stage.
Sourcepub fn centroids(&self) -> Result<Vec<&[f32]>>
pub fn centroids(&self) -> Result<Vec<&[f32]>>
Retrieve the centroids from the clustering process. Returns
a vector of k slices of size d.
Sourcepub fn centroids_mut(&mut self) -> Result<Vec<&mut [f32]>>
pub fn centroids_mut(&mut self) -> Result<Vec<&mut [f32]>>
Retrieve the centroids from the clustering process. Returns
a vector of k slices of size d.
Sourcepub fn iteration_stats(&self) -> &[ClusteringIterationStats]
pub fn iteration_stats(&self) -> &[ClusteringIterationStats]
Retrieve the stats achieved from the clustering process. Returns as many values as the number of iterations made.
Sourcepub fn iteration_stats_mut(&mut self) -> &mut [ClusteringIterationStats]
pub fn iteration_stats_mut(&mut self) -> &mut [ClusteringIterationStats]
Retrieve the stats. Returns as many values as the number of iterations made.
Sourcepub fn int_centroids(&self) -> bool
pub fn int_centroids(&self) -> bool
Getter for the int_centroids property of Clustering.
Round centroids coordinates to integer
Sourcepub fn update_index(&self) -> bool
pub fn update_index(&self) -> bool
Getter for the update_index property of Clustering.
Sourcepub fn frozen_centroids(&self) -> bool
pub fn frozen_centroids(&self) -> bool
Getter for the frozen_centroids property of Clustering.
Sourcepub fn decode_block_size(&self) -> usize
pub fn decode_block_size(&self) -> usize
Getter for the decode_block_size property of Clustering.
How many vectors at a time to decode
Sourcepub fn min_points_per_centroid(&self) -> u32
pub fn min_points_per_centroid(&self) -> u32
Getter for the minimum number of points per centroid.
Sourcepub fn max_points_per_centroid(&self) -> u32
pub fn max_points_per_centroid(&self) -> u32
Getter for the maximum number of points per centroid.