-
-
Notifications
You must be signed in to change notification settings - Fork 320
Expand file tree
/
Copy patherror.rs
More file actions
32 lines (31 loc) · 1.42 KB
/
error.rs
File metadata and controls
32 lines (31 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Error, Debug)]
pub enum Error {
#[error(transparent)]
LinfaError(#[from] linfa::Error),
#[error("More than two classes for logistic regression")]
TooManyClasses,
#[error("Fewer than two classes for logistic regression")]
TooFewClasses,
#[error(transparent)]
ArgMinError(#[from] argmin::core::Error),
#[error("Expected `x` and `y` to have same number of rows, got {0} != {1}")]
MismatchedShapes(usize, usize),
#[error("Values must be finite and not `Inf`, `-Inf` or `NaN`")]
InvalidValues,
#[error("Rows of initial parameter ({rows}) must be the same as the number of features ({n_features})")]
InitialParameterFeaturesMismatch { rows: usize, n_features: usize },
#[error("Columns of initial parameter ({cols}) must be the same as the number of classes ({n_classes})")]
InitialParameterClassesMismatch { cols: usize, n_classes: usize },
#[error("gradient_tolerance must be a positive, finite number")]
InvalidGradientTolerance,
#[error("alpha must be a positive, finite number")]
InvalidAlpha,
#[error("Initial parameters must be finite")]
InvalidInitialParameters,
#[error("Offset must be finite")]
InvalidOffset,
#[error("Offset length ({offset_len}) must match the number of samples ({n_samples})")]
OffsetLengthMismatch { offset_len: usize, n_samples: usize },
}