pub enum KMeansError {
InvalidParams(KMeansParamsError),
InertiaError,
LinfaError(Error),
}Expand description
An error when modeling a KMeans algorithm
Variants§
InvalidParams(KMeansParamsError)
When any of the hyperparameters are set the wrong value
InertiaError
When inertia computation fails
LinfaError(Error)
Trait Implementations§
Source§impl Debug for KMeansError
impl Debug for KMeansError
Source§impl Display for KMeansError
impl Display for KMeansError
Source§impl Error for KMeansError
impl Error for KMeansError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl<F: Float, R: Rng + Clone, DA: Data<Elem = F>, T, D: Distance<F>> Fit<ArrayBase<DA, Dim<[usize; 2]>>, T, KMeansError> for KMeansValidParams<F, R, D>
impl<F: Float, R: Rng + Clone, DA: Data<Elem = F>, T, D: Distance<F>> Fit<ArrayBase<DA, Dim<[usize; 2]>>, T, KMeansError> for KMeansValidParams<F, R, D>
Source§fn fit(
&self,
dataset: &DatasetBase<ArrayBase<DA, Ix2>, T>,
) -> Result<Self::Object, KMeansError>
fn fit( &self, dataset: &DatasetBase<ArrayBase<DA, Ix2>, T>, ) -> Result<Self::Object, KMeansError>
Given an input matrix observations, with shape (n_observations, n_features),
fit identifies n_clusters centroids based on the training data distribution.
An instance of KMeans is returned.
type Object = KMeans<F, D>
Source§impl From<Error> for KMeansError
impl From<Error> for KMeansError
Source§impl From<KMeansError> for GmmError
impl From<KMeansError> for GmmError
Source§fn from(source: KMeansError) -> Self
fn from(source: KMeansError) -> Self
Converts to this type from the input type.
Source§impl From<KMeansParamsError> for KMeansError
impl From<KMeansParamsError> for KMeansError
Source§fn from(source: KMeansParamsError) -> Self
fn from(source: KMeansParamsError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for KMeansError
impl RefUnwindSafe for KMeansError
impl Send for KMeansError
impl Sync for KMeansError
impl Unpin for KMeansError
impl UnwindSafe for KMeansError
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§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,
Compose
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>
Compose
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.