pub enum IncrKMeansError<M: Debug> {
InvalidParams(KMeansParamsError),
NotConverged(M),
LinfaError(Error),
}Variants§
InvalidParams(KMeansParamsError)
When any of the hyperparameters are set the wrong value
NotConverged(M)
When the distance between the old and new centroids exceeds the tolerance parameter. Not an actual error, just there to signal that the algorithm should keep running.
LinfaError(Error)
Trait Implementations§
Source§impl<M: Debug> Display for IncrKMeansError<M>
impl<M: Debug> Display for IncrKMeansError<M>
Source§impl<M: Debug> Error for IncrKMeansError<M>
impl<M: Debug> Error for IncrKMeansError<M>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl<'a, F: Float + Debug, R: Rng + Clone, DA: Data<Elem = F>, T, D: 'a + Distance<F> + Debug> FitWith<'a, ArrayBase<DA, Dim<[usize; 2]>>, T, IncrKMeansError<KMeans<F, D>>> for KMeansValidParams<F, R, D>
impl<'a, F: Float + Debug, R: Rng + Clone, DA: Data<Elem = F>, T, D: 'a + Distance<F> + Debug> FitWith<'a, ArrayBase<DA, Dim<[usize; 2]>>, T, IncrKMeansError<KMeans<F, D>>> for KMeansValidParams<F, R, D>
Source§fn fit_with(
&self,
model: Self::ObjectIn,
dataset: &'a DatasetBase<ArrayBase<DA, Ix2>, T>,
) -> Result<Self::ObjectOut, IncrKMeansError<Self::ObjectOut>>
fn fit_with( &self, model: Self::ObjectIn, dataset: &'a DatasetBase<ArrayBase<DA, Ix2>, T>, ) -> Result<Self::ObjectOut, IncrKMeansError<Self::ObjectOut>>
Performs a single batch update of the Mini-Batch K-means algorithm.
Given an input matrix observations, with shape (n_batch, n_features) and a previous
KMeans model, the model’s centroids are updated with the input matrix. If model is
None, then it’s initialized using the specified initialization algorithm. The return
value consists of the updated model and a bool value that indicates whether the algorithm
has converged.
Only KMeansAlgorithm::Lloyd is supported here: the
Mini-Batch path always uses Lloyd’s update. Configuring
KMeansAlgorithm::Hamerly and then calling
fit_with returns KMeansParamsError::IncrementalHamerly, because Hamerly’s
per-observation bounds rely on a persistent dataset across iterations and cannot
amortise across independent Mini-Batch batches.
type ObjectIn = Option<KMeans<F, D>>
type ObjectOut = KMeans<F, D>
Source§impl<M: Debug> From<Error> for IncrKMeansError<M>
impl<M: Debug> From<Error> for IncrKMeansError<M>
Source§impl<M: Debug> From<KMeansParamsError> for IncrKMeansError<M>
impl<M: Debug> From<KMeansParamsError> for IncrKMeansError<M>
Source§fn from(source: KMeansParamsError) -> Self
fn from(source: KMeansParamsError) -> Self
Auto Trait Implementations§
impl<M> Freeze for IncrKMeansError<M>where
M: Freeze,
impl<M> RefUnwindSafe for IncrKMeansError<M>where
M: RefUnwindSafe,
impl<M> Send for IncrKMeansError<M>where
M: Send,
impl<M> Sync for IncrKMeansError<M>where
M: Sync,
impl<M> Unpin for IncrKMeansError<M>where
M: Unpin,
impl<M> UnsafeUnpin for IncrKMeansError<M>where
M: UnsafeUnpin,
impl<M> UnwindSafe for IncrKMeansError<M>where
M: UnwindSafe,
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> 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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<B> Stagewise for B
impl<B> Stagewise for B
§fn chain_shrunk<C, F>(
self,
corrector: Shrunk<C, F>,
) -> ResidualChainParams<B, C, F>where
F: Float,
fn chain_shrunk<C, F>(
self,
corrector: Shrunk<C, F>,
) -> ResidualChainParams<B, C, F>where
F: Float,
self (as the base model) with a [Shrunk]-wrapped corrector,
which will be trained on the residuals left by self. Further stages can
be appended by calling .chain(...) or .chain_shrunk(...) on the
returned [ResidualChainParams]. Read more§fn chain<C, F, E>(self, corrector: C) -> ResidualChainParams<B, C, F>
fn chain<C, F, E>(self, corrector: C) -> ResidualChainParams<B, C, F>
self (as the base model) with corrector, which will be
trained on the residuals left by self. The corrector is used without
shrinkage (equivalent to shrink_by(1.0)). Further stages can be
appended by calling .chain(...) or .chain_shrunk(...) on the
returned [ResidualChainParams]. Read more§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>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.