pub enum HeadInputError {
Show 19 variants
TooFewClasses {
k: usize,
},
LabelCountMismatch {
labels: usize,
k: usize,
},
EmptyLabel {
index: usize,
},
DuplicateLabel {
first: usize,
second: usize,
label: String,
},
EmptyDataset,
RowCountMismatch {
rows: usize,
class_indices: usize,
},
ZeroFeatureDimension,
RaggedRow {
row: usize,
expected: usize,
found: usize,
},
NanFeature {
row: usize,
col: usize,
},
InfiniteFeature {
row: usize,
col: usize,
value: f32,
},
LabelIndexOutOfRange {
row: usize,
index: usize,
k: usize,
},
UnrepresentedClass {
class: usize,
},
NegativeLambda {
lambda: f64,
},
NonFiniteLambda {
lambda: f64,
},
NonPositiveC {
c: f64,
},
NonFiniteC {
c: f64,
},
FeatureDimMismatch {
row: usize,
expected: usize,
found: usize,
},
CoefficientCountMismatch {
array: &'static str,
expected: usize,
found: usize,
},
NonFiniteCoefficient {
array: &'static str,
index: usize,
value: f32,
},
}Expand description
A rejected fit or predict input, naming the offending element.
Every variant is produced by exactly one enumerated failure mode, so a caller can branch on the cause rather than parsing a message.
Variants§
TooFewClasses
n_classes < 2. A multinomial head needs at least a binary label set.
LabelCountMismatch
ordered_labels.len() disagrees with n_classes.
EmptyLabel
An ordered label is the empty string.
DuplicateLabel
Two ordered labels are equal, so the index -> label map is not injective.
Fields
EmptyDataset
No rows were supplied.
RowCountMismatch
The feature row count and the class-index count disagree.
ZeroFeatureDimension
The feature dimension is zero.
RaggedRow
A feature row has a different length than the first row.
Fields
NanFeature
A feature value is NaN.
InfiniteFeature
A feature value is an infinity.
Fields
LabelIndexOutOfRange
A class index is not in 0..n_classes.
Fields
UnrepresentedClass
A class in 0..n_classes has no rows assigned to it.
NegativeLambda
Regularization::Lambda was negative.
NonFiniteLambda
Regularization::Lambda was NaN or an infinity.
NonPositiveC
Regularization::SklearnEquivalentC was zero or negative.
NonFiniteC
Regularization::SklearnEquivalentC was NaN or an infinity.
FeatureDimMismatch
A prediction-time row has a different dimension than the fitted one.
Fields
CoefficientCountMismatch
Stored coefficients do not describe a K x d weight matrix plus K intercepts.
Reached only from MultinomialLogisticRegression::from_stored_coefficients,
the reload door: a fit produces its own coefficients and cannot get this wrong.
Fields
NonFiniteCoefficient
A stored coefficient is NaN or an infinity.
Reached only from the reload door. A non-finite coefficient makes every logit non-finite, so it is refused at the boundary rather than surfacing later as a per-row prediction failure.
Trait Implementations§
Source§impl Clone for HeadInputError
impl Clone for HeadInputError
Source§fn clone(&self) -> HeadInputError
fn clone(&self) -> HeadInputError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HeadInputError
impl Debug for HeadInputError
Source§impl Display for HeadInputError
impl Display for HeadInputError
Source§impl Error for HeadInputError
impl Error for HeadInputError
1.30.0 · 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
use the Display impl or to_string()
Source§impl From<HeadInputError> for HeadFitError
impl From<HeadInputError> for HeadFitError
Source§fn from(e: HeadInputError) -> HeadFitError
fn from(e: HeadInputError) -> HeadFitError
Source§impl PartialEq for HeadInputError
impl PartialEq for HeadInputError
impl StructuralPartialEq for HeadInputError
Auto Trait Implementations§
impl Freeze for HeadInputError
impl RefUnwindSafe for HeadInputError
impl Send for HeadInputError
impl Sync for HeadInputError
impl Unpin for HeadInputError
impl UnsafeUnpin for HeadInputError
impl UnwindSafe for HeadInputError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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