#[cfg(feature = "serde")]
use serde_crate::{Deserialize, Serialize};
use thiserror::Error;
pub type Result<T> = std::result::Result<T, ElasticNetError>;
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
#[derive(Debug, Clone, Error)]
pub enum ElasticNetError {
#[error("not enough samples as they have to be larger than number of features")]
NotEnoughSamples,
#[error("the data is ill-conditioned")]
IllConditioned,
#[error("l1 ratio should be in range [0, 1], but is {0}")]
InvalidL1Ratio(f32),
#[error("invalid penalty {0}")]
InvalidPenalty(f32),
#[error("invalid tolerance {0}")]
InvalidTolerance(f32),
#[error("the target can either be a vector (ndim=1) or a matrix (ndim=2)")]
IncorrectTargetShape,
#[error(transparent)]
BaseCrate(#[from] linfa::Error),
}