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 more