pub struct KMeans {
pub n_clusters: usize,
pub max_iter: usize,
pub tol: f32,
pub n_init: usize,
pub init: KMeansInit,
pub cluster_centers_: Option<Vec<Vec<f32>>>,
pub labels_: Option<Vec<usize>>,
pub inertia_: Option<f32>,
pub n_iter_: usize,
}Expand description
K-Means clustering using Lloyd’s algorithm
Fields§
§n_clusters: usize§max_iter: usize§tol: f32§n_init: usize§init: KMeansInit§cluster_centers_: Option<Vec<Vec<f32>>>§labels_: Option<Vec<usize>>§inertia_: Option<f32>§n_iter_: usizeImplementations§
Source§impl KMeans
impl KMeans
pub fn new(n_clusters: usize) -> Self
pub fn max_iter(self, n: usize) -> Self
pub fn n_init(self, n: usize) -> Self
pub fn init(self, init: KMeansInit) -> Self
pub fn fit(&mut self, x: &Tensor)
pub fn predict(&self, x: &Tensor) -> Tensor
pub fn fit_predict(&mut self, x: &Tensor) -> Tensor
pub fn transform(&self, x: &Tensor) -> Tensor
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more