make default params available to serde (#167)
* add seed param to search params * make default params available to serde * lints * create defaults for enums * lint
This commit is contained in:
@@ -114,10 +114,13 @@ impl<T: RealNumber, M: Matrix<T>> NBDistribution<T, M> for BernoulliNBDistributi
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct BernoulliNBParameters<T: RealNumber> {
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Additive (Laplace/Lidstone) smoothing parameter (0 for no smoothing).
|
||||
pub alpha: T,
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Prior probabilities of the classes. If specified the priors are not adjusted according to the data
|
||||
pub priors: Option<Vec<T>>,
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Threshold for binarizing (mapping to booleans) of sample features. If None, input is presumed to already consist of binary vectors.
|
||||
pub binarize: Option<T>,
|
||||
}
|
||||
@@ -154,10 +157,13 @@ impl<T: RealNumber> Default for BernoulliNBParameters<T> {
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct BernoulliNBSearchParameters<T: RealNumber> {
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Additive (Laplace/Lidstone) smoothing parameter (0 for no smoothing).
|
||||
pub alpha: Vec<T>,
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Prior probabilities of the classes. If specified the priors are not adjusted according to the data
|
||||
pub priors: Vec<Option<Vec<T>>>,
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Threshold for binarizing (mapping to booleans) of sample features. If None, input is presumed to already consist of binary vectors.
|
||||
pub binarize: Vec<Option<T>>,
|
||||
}
|
||||
|
||||
@@ -243,6 +243,7 @@ impl<T: RealNumber> CategoricalNBDistribution<T> {
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CategoricalNBParameters<T: RealNumber> {
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Additive (Laplace/Lidstone) smoothing parameter (0 for no smoothing).
|
||||
pub alpha: T,
|
||||
}
|
||||
@@ -265,6 +266,7 @@ impl<T: RealNumber> Default for CategoricalNBParameters<T> {
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CategoricalNBSearchParameters<T: RealNumber> {
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Additive (Laplace/Lidstone) smoothing parameter (0 for no smoothing).
|
||||
pub alpha: Vec<T>,
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ impl<T: RealNumber, M: Matrix<T>> NBDistribution<T, M> for GaussianNBDistributio
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GaussianNBParameters<T: RealNumber> {
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Prior probabilities of the classes. If specified the priors are not adjusted according to the data
|
||||
pub priors: Option<Vec<T>>,
|
||||
}
|
||||
@@ -100,6 +101,7 @@ impl<T: RealNumber> Default for GaussianNBParameters<T> {
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GaussianNBSearchParameters<T: RealNumber> {
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Prior probabilities of the classes. If specified the priors are not adjusted according to the data
|
||||
pub priors: Vec<Option<Vec<T>>>,
|
||||
}
|
||||
|
||||
@@ -86,8 +86,10 @@ impl<T: RealNumber, M: Matrix<T>> NBDistribution<T, M> for MultinomialNBDistribu
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct MultinomialNBParameters<T: RealNumber> {
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Additive (Laplace/Lidstone) smoothing parameter (0 for no smoothing).
|
||||
pub alpha: T,
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Prior probabilities of the classes. If specified the priors are not adjusted according to the data
|
||||
pub priors: Option<Vec<T>>,
|
||||
}
|
||||
@@ -118,8 +120,10 @@ impl<T: RealNumber> Default for MultinomialNBParameters<T> {
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct MultinomialNBSearchParameters<T: RealNumber> {
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Additive (Laplace/Lidstone) smoothing parameter (0 for no smoothing).
|
||||
pub alpha: Vec<T>,
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
/// Prior probabilities of the classes. If specified the priors are not adjusted according to the data
|
||||
pub priors: Vec<Option<Vec<T>>>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user