pub struct FittedComplementNB<F> { /* private fields */ }Expand description
Fitted Complement Naive Bayes classifier.
Implementations§
Source§impl<F: Float + Send + Sync + 'static> FittedComplementNB<F>
impl<F: Float + Send + Sync + 'static> FittedComplementNB<F>
Sourcepub fn partial_fit(
&mut self,
x: &Array2<F>,
y: &Array1<usize>,
) -> Result<(), FerroError>
pub fn partial_fit( &mut self, x: &Array2<F>, y: &Array1<usize>, ) -> Result<(), FerroError>
Incrementally update the model with new data.
Accumulates feature counts and class counts, then recomputes the complement weights.
§Errors
FerroError::ShapeMismatchifxandyhave different row counts or the number of features does not match the fitted model.FerroError::InvalidParameterif any feature value is negative.
Sourcepub fn predict_proba(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
pub fn predict_proba(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
Predict class probabilities for the given feature matrix.
Converts complement scores (lower=better) to probabilities by negating and applying softmax.
Returns shape (n_samples, n_classes) where each row sums to 1.
§Errors
Returns FerroError::ShapeMismatch if the number of features does
not match the fitted model.
Trait Implementations§
Source§impl<F: Clone> Clone for FittedComplementNB<F>
impl<F: Clone> Clone for FittedComplementNB<F>
Source§fn clone(&self) -> FittedComplementNB<F>
fn clone(&self) -> FittedComplementNB<F>
Returns a duplicate 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: Debug> Debug for FittedComplementNB<F>
impl<F: Debug> Debug for FittedComplementNB<F>
Source§impl<F: Float + Send + Sync + 'static> HasClasses for FittedComplementNB<F>
impl<F: Float + Send + Sync + 'static> HasClasses for FittedComplementNB<F>
Source§impl<F: Float + Send + Sync + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedComplementNB<F>
impl<F: Float + Send + Sync + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedComplementNB<F>
Source§fn predict(&self, x: &Array2<F>) -> Result<Array1<usize>, FerroError>
fn predict(&self, x: &Array2<F>) -> Result<Array1<usize>, FerroError>
Predict class labels for the given feature matrix.
Predicts the class with the lowest complement score.
§Errors
Returns FerroError::ShapeMismatch if the number of features does
not match the fitted model.
Source§type Output = ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>
type Output = ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>
The prediction output type (e.g.,
ndarray::Array1<F> or ndarray::Array1<usize>).Source§type Error = FerroError
type Error = FerroError
The error type returned by
predict.Auto Trait Implementations§
impl<F> Freeze for FittedComplementNB<F>where
F: Freeze,
impl<F> RefUnwindSafe for FittedComplementNB<F>where
F: RefUnwindSafe,
impl<F> Send for FittedComplementNB<F>where
F: Send,
impl<F> Sync for FittedComplementNB<F>where
F: Sync,
impl<F> Unpin for FittedComplementNB<F>where
F: Unpin,
impl<F> UnsafeUnpin for FittedComplementNB<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for FittedComplementNB<F>where
F: UnwindSafe + RefUnwindSafe,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more