Enum linfa_clustering::KMeansInit
source · #[non_exhaustive]pub enum KMeansInit<F: Float> {
Random,
Precomputed(Array2<F>),
KMeansPlusPlus,
KMeansPara,
}
Expand description
Specifies centroid initialization algorithm for KMeans.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Random
Pick random points as centroids.
Precomputed(Array2<F>)
Precomputed list of centroids, represented as an array of (n_centroids, n_features).
KMeansPlusPlus
K-means++ algorithm. Using this over random initialization causes K-means to converge faster for almost all cases, since K-means++ produces better centroids.
KMeansPara
K-means|| algorithm, a parallelized version of K-means++. Performs much better than K-means++ when the number of clusters is large (>100) while producing similar centroids, so use this for larger datasets. Details on the algorithm can be found here.
Trait Implementations§
source§impl<F: Clone + Float> Clone for KMeansInit<F>
impl<F: Clone + Float> Clone for KMeansInit<F>
source§fn clone(&self) -> KMeansInit<F>
fn clone(&self) -> KMeansInit<F>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<F: PartialEq + Float> PartialEq for KMeansInit<F>
impl<F: PartialEq + Float> PartialEq for KMeansInit<F>
source§fn eq(&self, other: &KMeansInit<F>) -> bool
fn eq(&self, other: &KMeansInit<F>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<F: Float> StructuralPartialEq for KMeansInit<F>
Auto Trait Implementations§
impl<F> RefUnwindSafe for KMeansInit<F>where F: RefUnwindSafe,
impl<F> Send for KMeansInit<F>
impl<F> Sync for KMeansInit<F>
impl<F> Unpin for KMeansInit<F>
impl<F> UnwindSafe for KMeansInit<F>where F: RefUnwindSafe,
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