Skip to main content

HeadInputError

Enum HeadInputError 

Source
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.

Fields

§k: usize

The rejected class count.

§

LabelCountMismatch

ordered_labels.len() disagrees with n_classes.

Fields

§labels: usize

Number of labels supplied.

§k: usize

Configured class count.

§

EmptyLabel

An ordered label is the empty string.

Fields

§index: usize

Index of the empty label.

§

DuplicateLabel

Two ordered labels are equal, so the index -> label map is not injective.

Fields

§first: usize

First index carrying the label.

§second: usize

Second index carrying the same label.

§label: String

The duplicated label.

§

EmptyDataset

No rows were supplied.

§

RowCountMismatch

The feature row count and the class-index count disagree.

Fields

§rows: usize

Number of feature rows.

§class_indices: usize

Number of class indices.

§

ZeroFeatureDimension

The feature dimension is zero.

§

RaggedRow

A feature row has a different length than the first row.

Fields

§row: usize

Index of the offending row.

§expected: usize

Dimension established by row 0.

§found: usize

Dimension found on this row.

§

NanFeature

A feature value is NaN.

Fields

§row: usize

Row index of the offending value.

§col: usize

Column index of the offending value.

§

InfiniteFeature

A feature value is an infinity.

Fields

§row: usize

Row index of the offending value.

§col: usize

Column index of the offending value.

§value: f32

The offending value.

§

LabelIndexOutOfRange

A class index is not in 0..n_classes.

Fields

§row: usize

Row carrying the out-of-range index.

§index: usize

The offending index.

§k: usize

Configured class count.

§

UnrepresentedClass

A class in 0..n_classes has no rows assigned to it.

Fields

§class: usize

The unrepresented class index.

§

NegativeLambda

Regularization::Lambda was negative.

Fields

§lambda: f64

The rejected value.

§

NonFiniteLambda

Regularization::Lambda was NaN or an infinity.

Fields

§lambda: f64

The rejected value.

§

NonPositiveC

Regularization::SklearnEquivalentC was zero or negative.

Fields

§c: f64

The rejected value.

§

NonFiniteC

Regularization::SklearnEquivalentC was NaN or an infinity.

Fields

§c: f64

The rejected value.

§

FeatureDimMismatch

A prediction-time row has a different dimension than the fitted one.

Fields

§row: usize

Row index of the offending row.

§expected: usize

The fitted feature dimension.

§found: usize

The dimension supplied.

§

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

§array: &'static str

Which array was the wrong size ("weights" or "intercepts").

§expected: usize

The count implied by the label map and the feature dimension.

§found: usize

The count supplied.

§

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.

Fields

§array: &'static str

Which array carried it ("weights" or "intercepts").

§index: usize

Flat index of the offending value.

§value: f32

The offending value.

Trait Implementations§

Source§

impl Clone for HeadInputError

Source§

fn clone(&self) -> HeadInputError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HeadInputError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for HeadInputError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Error for HeadInputError

1.30.0 · Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<HeadInputError> for HeadFitError

Source§

fn from(e: HeadInputError) -> HeadFitError

Converts to this type from the input type.
Source§

impl PartialEq for HeadInputError

Source§

fn eq(&self, other: &HeadInputError) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HeadInputError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,