Clustering

Struct Clustering 

Source
pub struct Clustering { /* private fields */ }
Expand description

The clustering algorithm.

Implementations§

Source§

impl Clustering

Source

pub fn new(d: u32, k: u32) -> Result<Self>

Obtain a new clustering object with the given dimensionality d and number of centroids k.

Source

pub fn new_with_params( d: u32, k: u32, params: &ClusteringParameters, ) -> Result<Self>

Obtain a new clustering object, with the given clustering parameters.

Source

pub fn train<I>(&mut self, x: &[f32], index: &mut I) -> Result<()>
where I: ?Sized + NativeIndex<Inner = FaissIndex>,

Perform the clustering algorithm with the given data and index. The index is used during the assignment stage.

Source

pub fn centroids(&self) -> Result<Vec<&[f32]>>

Retrieve the centroids from the clustering process. Returns a vector of k slices of size d.

Source

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.

Source

pub fn iteration_stats(&self) -> &[ClusteringIterationStats]

Retrieve the stats achieved from the clustering process. Returns as many values as the number of iterations made.

Source

pub fn iteration_stats_mut(&mut self) -> &mut [ClusteringIterationStats]

Retrieve the stats. Returns as many values as the number of iterations made.

Source

pub fn d(&self) -> u32

Getter for the clustering object’s vector dimensionality.

Source

pub fn k(&self) -> u32

Getter for the number of centroids.

Source

pub fn niter(&self) -> u32

Getter for the number of k-means iterations.

Source

pub fn nredo(&self) -> u32

Getter for the nredo property of Clustering.

Source

pub fn verbose(&self) -> bool

Getter for the verbose property of Clustering.

Source

pub fn spherical(&self) -> bool

Getter for whether spherical clustering is intended.

Source

pub fn int_centroids(&self) -> bool

Getter for the int_centroids property of Clustering. Round centroids coordinates to integer

Source

pub fn update_index(&self) -> bool

Getter for the update_index property of Clustering.

Source

pub fn frozen_centroids(&self) -> bool

Getter for the frozen_centroids property of Clustering.

Source

pub fn seed(&self) -> u32

Getter for the seed property of Clustering.

Source

pub fn decode_block_size(&self) -> usize

Getter for the decode_block_size property of Clustering. How many vectors at a time to decode

Source

pub fn min_points_per_centroid(&self) -> u32

Getter for the minimum number of points per centroid.

Source

pub fn max_points_per_centroid(&self) -> u32

Getter for the maximum number of points per centroid.

Trait Implementations§

Source§

impl Drop for Clustering

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Clustering

Source§

impl Sync for Clustering

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.