1#[cfg(feature = "serde")]
2use serde_crate::{Deserialize, Serialize};
3use thiserror::Error;
4
5#[cfg_attr(
6 feature = "serde",
7 derive(Serialize, Deserialize),
8 serde(crate = "serde_crate")
9)]
10#[derive(Error, Debug)]
11pub enum FtrlError {
12 #[error("l1 ratio should be in range [0, 1], but is {0}")]
13 InvalidL1Ratio(f32),
14 #[error("l2 ratio should be in range [0, 1], but is {0}")]
15 InvalidL2Ratio(f32),
16 #[error("alpha should be positive and finite, but is {0}")]
17 InvalidAlpha(f32),
18 #[error("beta should be positive and finite, but is {0}")]
19 InvalidBeta(f32),
20 #[error("number of features must be bigger than 0, but is {0}")]
21 InvalidNFeatures(usize),
22 #[error(transparent)]
23 LinfaError(#[from] linfa::error::Error),
24}