#[non_exhaustive]pub enum FerroError {
ShapeMismatch {
expected: Vec<usize>,
actual: Vec<usize>,
context: String,
},
InsufficientSamples {
required: usize,
actual: usize,
context: String,
},
ConvergenceFailure {
iterations: usize,
message: String,
},
InvalidParameter {
name: String,
reason: String,
},
NumericalInstability {
message: String,
},
IoError(Error),
SerdeError {
message: String,
},
}Expand description
The unified error type for all ferrolearn operations.
Every public function in ferrolearn returns Result<T, FerroError>.
The enum is #[non_exhaustive] so that new variants can be added in
future minor releases without breaking downstream code.
§Examples
use ferrolearn_core::FerroError;
let err = FerroError::ShapeMismatch {
expected: vec![100, 10],
actual: vec![100, 5],
context: "feature matrix".into(),
};
assert!(err.to_string().contains("Shape mismatch"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ShapeMismatch
Array dimensions do not match the expected shape.
Fields
InsufficientSamples
Not enough samples were provided for the requested operation.
Fields
ConvergenceFailure
An iterative algorithm did not converge within the allowed iterations.
Fields
InvalidParameter
A hyperparameter or configuration value is invalid.
NumericalInstability
A numerical computation produced NaN, infinity, or other instability.
IoError(Error)
An I/O error occurred during data loading or model persistence.
SerdeError
A serialization or deserialization error occurred.
Trait Implementations§
Source§impl Debug for FerroError
impl Debug for FerroError
Source§impl Display for FerroError
impl Display for FerroError
Source§impl Error for FerroError
impl Error for FerroError
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()
Auto Trait Implementations§
impl Freeze for FerroError
impl !RefUnwindSafe for FerroError
impl Send for FerroError
impl Sync for FerroError
impl Unpin for FerroError
impl UnsafeUnpin for FerroError
impl !UnwindSafe for FerroError
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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