linfa_bayes/error.rs
1use ndarray_stats::errors::MinMaxError;
2use thiserror::Error;
3
4/// Simplified `Result` using [`NaiveBayesError`](crate::NaiveBayesError) as error type
5pub type Result<T> = std::result::Result<T, NaiveBayesError>;
6
7/// Error variants from hyper-parameter construction or model estimation
8#[derive(Error, Debug)]
9pub enum NaiveBayesError {
10 /// Error when performing Max operation on data
11 #[error("invalid statistical operation {0}")]
12 Stats(#[from] MinMaxError),
13 /// Invalid smoothing parameter
14 #[error("invalid smoothing parameter {0}")]
15 InvalidSmoothing(f64),
16 #[error(transparent)]
17 BaseCrate(#[from] linfa::Error),
18}