Struct linfa_bayes::MultinomialNbParams
source · pub struct MultinomialNbParams<F, L>(/* private fields */);
Expand description
A hyper-parameter set during construction for a Multinomial Naive Bayes model.
The parameter set can be verified into a
MultinomialNbValidParams
by calling
ParamGuard::check. It is also possible to directly fit a model with
Fit::fit or
FitWith::fit_with which implicitely verifies the parameter set
prior to the model estimation and forwards any error.
See MultinomialNb
for information on the model.
Parameters
Name | Default | Purpose | Range |
---|---|---|---|
alpha | 1 | Additive (Laplace/Lidstone) smoothing parameter (0 for no smoothing) | [0, inf) |
Errors
The following errors can come from invalid hyper-parameters:
Returns InvalidSmoothing
if the smoothing
parameter is negative.
Implementations§
source§impl<F: Float, L> MultinomialNbParams<F, L>
impl<F: Float, L> MultinomialNbParams<F, L>
sourcepub fn new() -> Self
pub fn new() -> Self
Create new MultinomialNbParams set with default values for its parameters
Trait Implementations§
source§impl<F: Clone, L: Clone> Clone for MultinomialNbParams<F, L>
impl<F: Clone, L: Clone> Clone for MultinomialNbParams<F, L>
source§fn clone(&self) -> MultinomialNbParams<F, L>
fn clone(&self) -> MultinomialNbParams<F, L>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<F: Float, L> Default for MultinomialNbParams<F, L>
impl<F: Float, L> Default for MultinomialNbParams<F, L>
source§impl<F: Float, L> ParamGuard for MultinomialNbParams<F, L>
impl<F: Float, L> ParamGuard for MultinomialNbParams<F, L>
§type Checked = MultinomialNbValidParams<F, L>
type Checked = MultinomialNbValidParams<F, L>
The checked hyperparameters
§type Error = NaiveBayesError
type Error = NaiveBayesError
Error type resulting from failed hyperparameter checking
source§fn check_ref(&self) -> Result<&Self::Checked, Self::Error>
fn check_ref(&self) -> Result<&Self::Checked, Self::Error>
Checks the hyperparameters and returns a reference to the checked hyperparameters if
successful
source§fn check(self) -> Result<Self::Checked, Self::Error>
fn check(self) -> Result<Self::Checked, Self::Error>
Checks the hyperparameters and returns the checked hyperparameters if successful
source§fn check_unwrap(self) -> Self::Checkedwhere
Self: Sized,
fn check_unwrap(self) -> Self::Checkedwhere Self: Sized,
Calls
check()
and unwraps the resultsource§impl<F: PartialEq, L: PartialEq> PartialEq for MultinomialNbParams<F, L>
impl<F: PartialEq, L: PartialEq> PartialEq for MultinomialNbParams<F, L>
source§fn eq(&self, other: &MultinomialNbParams<F, L>) -> bool
fn eq(&self, other: &MultinomialNbParams<F, L>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<F: Eq, L: Eq> Eq for MultinomialNbParams<F, L>
impl<F, L> StructuralEq for MultinomialNbParams<F, L>
impl<F, L> StructuralPartialEq for MultinomialNbParams<F, L>
Auto Trait Implementations§
impl<F, L> RefUnwindSafe for MultinomialNbParams<F, L>where F: RefUnwindSafe, L: RefUnwindSafe,
impl<F, L> Send for MultinomialNbParams<F, L>where F: Send, L: Send,
impl<F, L> Sync for MultinomialNbParams<F, L>where F: Sync, L: Sync,
impl<F, L> Unpin for MultinomialNbParams<F, L>where F: Unpin, L: Unpin,
impl<F, L> UnwindSafe for MultinomialNbParams<F, L>where F: UnwindSafe, L: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.