linfa_preprocessing/
error.rs

1//! Error definitions for preprocessing
2use 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    TokenizerNotSet,
18    #[error("Tokenizer must be defined after deserializing CountVectorizer by calling force_tokenizer_redefinition")]
19    FlippedMinMaxRange,
20    #[error("n_gram boundaries cannot be zero (min = {0}, max = {1})")]
21    InvalidNGramBoundaries(usize, usize),
22    #[error("n_gram min boundary cannot be greater than max boundary (min = {0}, max = {1})")]
23    FlippedNGramBoundaries(usize, usize),
24    #[error("document frequencies have to be between 0 and 1 (min = {0}, max = {1})")]
25    InvalidDocumentFrequencies(f32, f32),
26    #[error("min document frequency cannot be greater than max document frequency (min = {0}, max = {1})")]
27    FlippedDocumentFrequencies(f32, f32),
28    #[error(transparent)]
29    RegexError(#[from] regex::Error),
30    #[error(transparent)]
31    IoError(#[from] std::io::Error),
32    #[error("Encoding error {0}")]
33    EncodingError(std::borrow::Cow<'static, str>),
34    #[cfg(feature = "blas")]
35    #[error(transparent)]
36    LinalgBlasError(#[from] ndarray_linalg::error::LinalgError),
37    #[error(transparent)]
38    LinalgError(#[from] linfa_linalg::LinalgError),
39    #[error(transparent)]
40    NdarrayStatsEmptyError(#[from] ndarray_stats::errors::EmptyInput),
41    #[error(transparent)]
42    LinfaError(#[from] linfa::error::Error),
43}