pub struct PassiveAggressive { /* private fields */ }Expand description
Passive-Aggressive classifier (Crammer et al. 2006).
Labels must be in {−1, +1}. The PA family uses the hinge loss
ℓ = max(0, 1 − y(w·x + b)) and then computes a closed-form
minimal weight update.
Implementations§
Source§impl PassiveAggressive
impl PassiveAggressive
Sourcepub fn new(n_features: usize, variant: PAVariant) -> Self
pub fn new(n_features: usize, variant: PAVariant) -> Self
Create a new PA classifier. variant controls the update rule.
Sourcepub fn with_aggressiveness(self, c: f64) -> Result<Self, OnlineError>
pub fn with_aggressiveness(self, c: f64) -> Result<Self, OnlineError>
Set the aggressiveness parameter C (must be positive).
Sourcepub fn stats(&self) -> &OnlineStats
pub fn stats(&self) -> &OnlineStats
Reference to running statistics.
Trait Implementations§
Source§impl Clone for PassiveAggressive
impl Clone for PassiveAggressive
Source§fn clone(&self) -> PassiveAggressive
fn clone(&self) -> PassiveAggressive
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 Debug for PassiveAggressive
impl Debug for PassiveAggressive
Source§impl OnlineLearner for PassiveAggressive
impl OnlineLearner for PassiveAggressive
Source§fn update(
&mut self,
features: &[f64],
label: f64,
) -> Result<OnlineUpdateResult, OnlineError>
fn update( &mut self, features: &[f64], label: f64, ) -> Result<OnlineUpdateResult, OnlineError>
Update model on a single (features, label) pair. Returns update stats.
Auto Trait Implementations§
impl Freeze for PassiveAggressive
impl RefUnwindSafe for PassiveAggressive
impl Send for PassiveAggressive
impl Sync for PassiveAggressive
impl Unpin for PassiveAggressive
impl UnsafeUnpin for PassiveAggressive
impl UnwindSafe for PassiveAggressive
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> 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