linfa_reduction/
error.rs

1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, ReductionError>;
4
5#[derive(Error, Debug)]
6#[non_exhaustive]
7pub enum ReductionError {
8    #[error("At least 1 sample needed")]
9    NotEnoughSamples,
10    #[error("embedding dimension smaller {0} than feature dimension")]
11    EmbeddingTooSmall(usize),
12    #[error("Number of steps zero in diffusion map operator")]
13    StepsZero,
14    #[cfg(feature = "blas")]
15    #[error(transparent)]
16    LinalgBlasError(#[from] ndarray_linalg::error::LinalgError),
17    #[error(transparent)]
18    LinalgError(#[from] linfa_linalg::LinalgError),
19    #[error(transparent)]
20    LinfaError(#[from] linfa::error::Error),
21    #[error(transparent)]
22    NdarrayRandError(#[from] ndarray_rand::rand_distr::NormalError),
23    #[error("Precision parameter must be in the interval (0; 1)")]
24    InvalidPrecision,
25    #[error("Target dimension of the projection must be positive")]
26    NonPositiveEmbeddingSize,
27    #[error("Target dimension {0} is larger than the number of features {1}.")]
28    DimensionIncrease(usize, usize),
29}