pub enum ClassWeight<F> {
None,
Balanced,
Explicit(HashMap<usize, F>),
}Expand description
Per-class weighting strategy for RidgeClassifier (sklearn
class_weight, sklearn/linear_model/_ridge.py:1398).
Mirrors sklearn.utils.class_weight.compute_class_weight: the chosen
per-class weight multiplies into any user sample_weight BEFORE the
weighted ridge fit (_ridge.py:1305-1307,
sample_weight = sample_weight * compute_sample_weight(self.class_weight, y)).
ClassWeight::None— all classes weight1.0(sklearnNone,_ridge.py:1400).ClassWeight::Balanced—n_samples / (n_classes * bincount(y))(sklearn'balanced',_ridge.py:1402-1404,class_weight.py:73).ClassWeight::Explicit— map of class label → weight; classes absent from the map keep weight1.0(sklearn dict,class_weight.py:77-81).
Variants§
None
All classes have weight 1.0 (sklearn None).
Balanced
Inversely proportional to class frequency:
n_samples / (n_classes * count[c]) (sklearn 'balanced').
Explicit(HashMap<usize, F>)
Explicit per-class weights; classes not present default to 1.0
(sklearn dict).
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 moreSource§impl<F: Debug> Debug for ClassWeight<F>
impl<F: Debug> Debug for ClassWeight<F>
Source§impl<F> Default for ClassWeight<F>
impl<F> Default for ClassWeight<F>
Source§fn default() -> ClassWeight<F>
fn default() -> ClassWeight<F>
Returns the “default value” for a type. Read more
Auto 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