linfa_preprocessing/
error.rs1use thiserror::Error;
3pub type Result<T> = std::result::Result<T, PreprocessingError>;
4
5#[derive(Error, Debug)]
6#[non_exhaustive]
7pub enum PreprocessingError {
8 #[error("wrong measure ({0}) for scaler: {1}")]
9 WrongMeasureForScaler(String, String),
10 #[error("subsamples greater than total samples: {0} > {1}")]
11 TooManySubsamples(usize, usize),
12 #[error("not enough samples")]
13 NotEnoughSamples,
14 #[error("not a valid float")]
15 InvalidFloat,
16 #[error("minimum value for MinMax scaler cannot be greater than the maximum")]
17 FlippedMinMaxRange,
18 #[error("n_gram boundaries cannot be zero (min = {0}, max = {1})")]
19 InvalidNGramBoundaries(usize, usize),
20 #[error("n_gram min boundary cannot be greater than max boundary (min = {0}, max = {1})")]
21 FlippedNGramBoundaries(usize, usize),
22 #[error("document frequencies have to be between 0 and 1 (min = {0}, max = {1})")]
23 InvalidDocumentFrequencies(f32, f32),
24 #[error("min document frequency cannot be greater than max document frequency (min = {0}, max = {1})")]
25 FlippedDocumentFrequencies(f32, f32),
26 #[error(transparent)]
27 RegexError(#[from] regex::Error),
28 #[error(transparent)]
29 IoError(#[from] std::io::Error),
30 #[error("Encoding error {0}")]
31 EncodingError(std::borrow::Cow<'static, str>),
32 #[cfg(feature = "blas")]
33 #[error(transparent)]
34 LinalgBlasError(#[from] ndarray_linalg::error::LinalgError),
35 #[error(transparent)]
36 LinalgError(#[from] linfa_linalg::LinalgError),
37 #[error(transparent)]
38 NdarrayStatsEmptyError(#[from] ndarray_stats::errors::EmptyInput),
39 #[error(transparent)]
40 LinfaError(#[from] linfa::error::Error),
41}