pub struct RandomUnderSampler { /* private fields */ }
Expand description
Random Under-sampling strategy
Reduces the majority class by randomly removing samples until the desired class balance is achieved.
Implementations§
Source§impl RandomUnderSampler
impl RandomUnderSampler
Sourcepub fn with_ratio(ratio: f64) -> Self
pub fn with_ratio(ratio: f64) -> Self
Create with specific ratio (0.0 to 1.0)
Sourcepub fn with_targets(targets: HashMap<i32, usize>) -> Self
pub fn with_targets(targets: HashMap<i32, usize>) -> Self
Create with specific target counts
Trait Implementations§
Source§impl Clone for RandomUnderSampler
impl Clone for RandomUnderSampler
Source§fn clone(&self) -> RandomUnderSampler
fn clone(&self) -> RandomUnderSampler
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 RandomUnderSampler
impl Debug for RandomUnderSampler
Source§impl Default for RandomUnderSampler
impl Default for RandomUnderSampler
Source§impl ResamplingStrategy for RandomUnderSampler
impl ResamplingStrategy for RandomUnderSampler
Source§type Output = (ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<i32>, Dim<[usize; 1]>>)
type Output = (ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<i32>, Dim<[usize; 1]>>)
Output data type
Source§type Config = RandomUnderSamplerConfig
type Config = RandomUnderSamplerConfig
Configuration type for this strategy
Source§fn resample(
&self,
x: ArrayView2<'_, f64>,
y: ArrayView1<'_, i32>,
config: &Self::Config,
) -> Result<(Array2<f64>, Array1<i32>), ResamplingError>
fn resample( &self, x: ArrayView2<'_, f64>, y: ArrayView1<'_, i32>, config: &Self::Config, ) -> Result<(Array2<f64>, Array1<i32>), ResamplingError>
Resample the input data to balance class distribution
Source§fn performance_hints(&self) -> PerformanceHints
fn performance_hints(&self) -> PerformanceHints
Consciousness-aligned performance hints
Auto Trait Implementations§
impl Freeze for RandomUnderSampler
impl RefUnwindSafe for RandomUnderSampler
impl Send for RandomUnderSampler
impl Sync for RandomUnderSampler
impl Unpin for RandomUnderSampler
impl UnwindSafe for RandomUnderSampler
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