pub struct KMeansConfig {
pub k: usize,
pub max_iterations: usize,
pub cost_threshold: f64,
}Expand description
Configuration for the k-means algorithm.
Fields§
§k: usizeNumber of clusters.
max_iterations: usizeMaximum number of iterations.
cost_threshold: f64Convergence threshold on cost change.
Implementations§
Source§impl KMeansConfig
impl KMeansConfig
Sourcepub fn new(k: usize) -> Self
pub fn new(k: usize) -> Self
Create a new configuration with the given number of clusters and default parameters.
Sourcepub fn with_max_iterations(self, max_iterations: usize) -> Self
pub fn with_max_iterations(self, max_iterations: usize) -> Self
Set maximum iterations.
Sourcepub fn with_cost_threshold(self, cost_threshold: f64) -> Self
pub fn with_cost_threshold(self, cost_threshold: f64) -> Self
Set convergence cost threshold.
Trait Implementations§
Source§impl Clone for KMeansConfig
impl Clone for KMeansConfig
Auto Trait Implementations§
impl Freeze for KMeansConfig
impl RefUnwindSafe for KMeansConfig
impl Send for KMeansConfig
impl Sync for KMeansConfig
impl Unpin for KMeansConfig
impl UnsafeUnpin for KMeansConfig
impl UnwindSafe for KMeansConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.