pub enum ClassWeight<F> {
None,
Balanced,
Explicit(Vec<(usize, F)>),
}Expand description
Per-class weighting strategy for SGDClassifier.
Mirrors sklearn’s class_weight parameter
(_stochastic_gradient.py constraint [dict, "balanced", None]); the
expanded per-class weights are computed by [compute_class_weight] following
sklearn.utils.compute_class_weight semantics and fed into the per-sample
update *= class_weight * sample_weight scaling (_sgd_fast.pyx.tp:630).
Variants§
None
Uniform weights (all classes weighted 1.0). The default.
Balanced
Balanced weights n_samples / (n_classes * count_c) per class c,
matching sklearn.utils.compute_class_weight("balanced", ...)
(class_weight.py:73).
Explicit(Vec<(usize, F)>)
Explicit class-label -> weight map. Classes absent from the map default
to 1.0, matching the dict branch of compute_class_weight
(class_weight.py:77-81).
Trait Implementations§
Source§impl<F: Clone> Clone for ClassWeight<F>
impl<F: Clone> Clone for ClassWeight<F>
Source§fn clone(&self) -> ClassWeight<F>
fn clone(&self) -> ClassWeight<F>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<F> Freeze for ClassWeight<F>
impl<F> RefUnwindSafe for ClassWeight<F>where
F: RefUnwindSafe,
impl<F> Send for ClassWeight<F>where
F: Send,
impl<F> Sync for ClassWeight<F>where
F: Sync,
impl<F> Unpin for ClassWeight<F>where
F: Unpin,
impl<F> UnsafeUnpin for ClassWeight<F>
impl<F> UnwindSafe for ClassWeight<F>where
F: 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<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,
impl<T, U> Imply<T> for U
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