pub struct KMeans { /* private fields */ }Expand description
A clustering-problem where each center can be any point in the metric space.
The metric space is the same space the points live in.
The cost of a cluster, given a center, is the sum of the squared Euclidean distances between the center and all points in the cluster. The center is automatically calculated to minimise the cost, which turns out to simply be the average of all point-positions in the cluster.
See the wikipedia-article on k-means-clustering for more information.
Implementations§
Trait Implementations§
Source§impl Cost for KMeans
impl Cost for KMeans
Source§fn num_points(&self) -> usize
fn num_points(&self) -> usize
Get the number of points that must be clustered. Read more
Source§fn approximate_clusterings(&mut self) -> Vec<(f64, Clustering)>
fn approximate_clusterings(&mut self) -> Vec<(f64, Clustering)>
Quickly calculate a not-necessarily-optimal clustering. Read more
Source§fn total_cost(&mut self, clustering: &Clustering) -> f64
fn total_cost(&mut self, clustering: &Clustering) -> f64
Get the total cost of a clustering.
Source§fn optimal_clusterings(&mut self) -> Vec<(f64, Clustering)>
fn optimal_clusterings(&mut self) -> Vec<(f64, Clustering)>
Source§fn price_of_hierarchy(&mut self) -> (f64, Vec<Clustering>)
fn price_of_hierarchy(&mut self) -> (f64, Vec<Clustering>)
Calculate the price-of-hierarchy of the clustering-problem, together with an optimal hierarchy. Read more
Source§fn greedy_hierarchy(&mut self) -> Vec<(f64, Clustering)>
fn greedy_hierarchy(&mut self) -> Vec<(f64, Clustering)>
Calculate a greedy hierarchical clustering. Read more
Source§fn price_of_greedy(&mut self) -> (f64, Vec<Clustering>)
fn price_of_greedy(&mut self) -> (f64, Vec<Clustering>)
Calculate the cost-ratio of a greedy hierarchical clustering. Read more
Auto Trait Implementations§
impl Freeze for KMeans
impl RefUnwindSafe for KMeans
impl Send for KMeans
impl Sync for KMeans
impl Unpin for KMeans
impl UnwindSafe for KMeans
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