#[non_exhaustive]pub struct MiniBatchKMeans { /* private fields */ }Expand description
Mini-Batch K-Means clustering.
Approximates standard K-Means by updating centroids using random mini-batches of the data at each iteration, rather than the full dataset. This is significantly faster for large datasets while producing similar results.
Implementations§
Source§impl MiniBatchKMeans
impl MiniBatchKMeans
Sourcepub fn batch_size(self, n: usize) -> Self
pub fn batch_size(self, n: usize) -> Self
Set the mini-batch size (default 1024).
Sourcepub fn fit(&mut self, data: &Dataset) -> Result<()>
pub fn fit(&mut self, data: &Dataset) -> Result<()>
Fit the model on a dataset (uses features only, ignores target).
Trait Implementations§
Source§impl Clone for MiniBatchKMeans
impl Clone for MiniBatchKMeans
Source§fn clone(&self) -> MiniBatchKMeans
fn clone(&self) -> MiniBatchKMeans
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl PartialFit for MiniBatchKMeans
impl PartialFit for MiniBatchKMeans
Source§fn partial_fit(&mut self, data: &Dataset) -> Result<()>
fn partial_fit(&mut self, data: &Dataset) -> Result<()>
Update centroids with a streaming average over the given batch.
On the first call, initializes centroids via K-Means++ on the batch.
Subsequent calls assign each sample to the nearest centroid and
update it with a decaying learning rate (1 / count).
Source§fn is_initialized(&self) -> bool
fn is_initialized(&self) -> bool
Whether the model has been initialized (at least one
partial_fit call).Auto Trait Implementations§
impl Freeze for MiniBatchKMeans
impl RefUnwindSafe for MiniBatchKMeans
impl Send for MiniBatchKMeans
impl Sync for MiniBatchKMeans
impl Unpin for MiniBatchKMeans
impl UnsafeUnpin for MiniBatchKMeans
impl UnwindSafe for MiniBatchKMeans
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,
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