pub struct KmeansSpec {
pub n: usize,
pub k: usize,
pub f: usize,
pub iters: usize,
pub points: Symbol,
pub centroids: Symbol,
pub distance: ZipTerm,
pub ties: Ties,
}Expand description
A recognized k-means clustering (Lloyd’s algorithm): n points of f integer features, row-major in points,
around k centroids, row-major in centroids, which start as the first k points. Each of iters epochs
assigns every point to its nearest centroid by the distance Σ_d term(point[d], centroid[d]) (ties as ties
says), sums each centroid’s points and counts them, then sets every centroid to the integer mean of its points —
0 for a centroid with none.
Fields§
§n: usize§k: usize§f: usize§iters: usize§points: Symbol§centroids: Symbol§distance: ZipTermThe distance a feature adds: ZipTerm::Read(0) the point’s, Read(1) the centroid’s.
ties: TiesImplementations§
Source§impl KmeansSpec
impl KmeansSpec
Sourcepub fn run(&self, points: &[i64], ints: (i128, i128)) -> Result<Vec<i64>, Stop>
pub fn run(&self, points: &[i64], ints: (i128, i128)) -> Result<Vec<i64>, Stop>
The final centroids (k × f, row-major) for the points points (n × f, row-major), as the program computes
them; refused (with why) when a distance, a sum of distance terms in any order, or a feature sum over the
points in any order leaves ints.
Trait Implementations§
Source§impl Clone for KmeansSpec
impl Clone for KmeansSpec
Source§fn clone(&self) -> KmeansSpec
fn clone(&self) -> KmeansSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KmeansSpec
impl Debug for KmeansSpec
Source§impl PartialEq for KmeansSpec
impl PartialEq for KmeansSpec
impl Eq for KmeansSpec
impl StructuralPartialEq for KmeansSpec
Auto Trait Implementations§
impl Freeze for KmeansSpec
impl RefUnwindSafe for KmeansSpec
impl Send for KmeansSpec
impl Sync for KmeansSpec
impl Unpin for KmeansSpec
impl UnsafeUnpin for KmeansSpec
impl UnwindSafe for KmeansSpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.