pub struct Winsorizer<State = Untrained> { /* private fields */ }Expand description
Winsorizer for capping extreme outliers
This transformer limits extreme values by replacing outliers with percentile values. For example, with lower_percentile=5 and upper_percentile=95, all values below the 5th percentile are set to the 5th percentile value, and all values above the 95th percentile are set to the 95th percentile value.
Implementations§
Source§impl Winsorizer<Untrained>
impl Winsorizer<Untrained>
Sourcepub fn with_percentiles(lower: Float, upper: Float) -> Self
pub fn with_percentiles(lower: Float, upper: Float) -> Self
Create a Winsorizer with specified percentiles
Sourcepub fn lower_percentile(self, percentile: Float) -> Self
pub fn lower_percentile(self, percentile: Float) -> Self
Set the lower percentile
Sourcepub fn upper_percentile(self, percentile: Float) -> Self
pub fn upper_percentile(self, percentile: Float) -> Self
Set the upper percentile
Sourcepub fn feature_wise(self, feature_wise: bool) -> Self
pub fn feature_wise(self, feature_wise: bool) -> Self
Set whether to winsorize features independently
Sourcepub fn nan_strategy(self, strategy: NanStrategy) -> Self
pub fn nan_strategy(self, strategy: NanStrategy) -> Self
Set the NaN handling strategy
Source§impl Winsorizer<Trained>
impl Winsorizer<Trained>
Sourcepub fn lower_bounds(&self) -> &Array1<Float>
pub fn lower_bounds(&self) -> &Array1<Float>
Get the lower bounds
Sourcepub fn upper_bounds(&self) -> &Array1<Float>
pub fn upper_bounds(&self) -> &Array1<Float>
Get the upper bounds
Sourcepub fn n_features_in(&self) -> usize
pub fn n_features_in(&self) -> usize
Get the number of features seen during fitting
Sourcepub fn winsorize_single(&self, feature_idx: usize, value: Float) -> Float
pub fn winsorize_single(&self, feature_idx: usize, value: Float) -> Float
Apply winsorization to a single value for a specific feature
Sourcepub fn get_winsorization_stats(
&self,
x: &Array2<Float>,
) -> Result<WinsorizationStats>
pub fn get_winsorization_stats( &self, x: &Array2<Float>, ) -> Result<WinsorizationStats>
Get statistics about the winsorization applied to the data
Trait Implementations§
Source§impl<State: Clone> Clone for Winsorizer<State>
impl<State: Clone> Clone for Winsorizer<State>
Source§fn clone(&self) -> Winsorizer<State>
fn clone(&self) -> Winsorizer<State>
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<State: Debug> Debug for Winsorizer<State>
impl<State: Debug> Debug for Winsorizer<State>
Source§impl Default for Winsorizer<Untrained>
impl Default for Winsorizer<Untrained>
Source§impl Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ()> for Winsorizer<Untrained>
impl Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ()> for Winsorizer<Untrained>
Source§type Fitted = Winsorizer<Trained>
type Fitted = Winsorizer<Trained>
The fitted model type
Source§fn fit(self, x: &Array2<Float>, _y: &()) -> Result<Self::Fitted>
fn fit(self, x: &Array2<Float>, _y: &()) -> Result<Self::Fitted>
Fit the model to the provided data with validation
Source§fn fit_with_validation(
self,
x: &X,
y: &Y,
_x_val: Option<&X>,
_y_val: Option<&Y>,
) -> Result<(Self::Fitted, FitMetrics), SklearsError>where
Self: Sized,
fn fit_with_validation(
self,
x: &X,
y: &Y,
_x_val: Option<&X>,
_y_val: Option<&Y>,
) -> Result<(Self::Fitted, FitMetrics), SklearsError>where
Self: Sized,
Fit with custom validation and early stopping
Auto Trait Implementations§
impl<State> Freeze for Winsorizer<State>
impl<State> RefUnwindSafe for Winsorizer<State>where
State: RefUnwindSafe,
impl<State> Send for Winsorizer<State>where
State: Send,
impl<State> Sync for Winsorizer<State>where
State: Sync,
impl<State> Unpin for Winsorizer<State>where
State: Unpin,
impl<State> UnwindSafe for Winsorizer<State>where
State: 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> 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