pub struct VarianceThreshold { /* private fields */ }
Expand description
VarianceThreshold for removing low-variance features
Features with variance below the threshold are removed. This is useful for removing features that are mostly constant and don’t provide much information.
Implementations§
Source§impl VarianceThreshold
impl VarianceThreshold
Sourcepub fn new(threshold: f64) -> Result<Self>
pub fn new(threshold: f64) -> Result<Self>
Creates a new VarianceThreshold selector
§Arguments
threshold
- Features with variance below this threshold are removed (default: 0.0)
§Returns
- A new VarianceThreshold instance
§Examples
use scirs2_transform::selection::VarianceThreshold;
// Remove features with variance less than 0.1
let selector = VarianceThreshold::new(0.1);
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Creates a VarianceThreshold with default threshold (0.0)
This will only remove features that are completely constant.
Sourcepub fn variances(&self) -> Option<&Array1<f64>>
pub fn variances(&self) -> Option<&Array1<f64>>
Returns the variances computed for each feature
§Returns
Option<&Array1<f64>>
- The variances for each feature
Sourcepub fn get_support(&self) -> Option<&Vec<usize>>
pub fn get_support(&self) -> Option<&Vec<usize>>
Returns the indices of selected features
§Returns
Option<&Vec<usize>>
- Indices of features that pass the variance threshold
Sourcepub fn get_support_mask(&self) -> Option<Array1<bool>>
pub fn get_support_mask(&self) -> Option<Array1<bool>>
Returns a boolean mask indicating which features are selected
§Returns
Option<Array1<bool>>
- Boolean mask where true indicates selected features
Sourcepub fn n_features_selected(&self) -> Option<usize>
pub fn n_features_selected(&self) -> Option<usize>
Returns the number of selected features
§Returns
Option<usize>
- Number of features that pass the variance threshold
Auto Trait Implementations§
impl Freeze for VarianceThreshold
impl RefUnwindSafe for VarianceThreshold
impl Send for VarianceThreshold
impl Sync for VarianceThreshold
impl Unpin for VarianceThreshold
impl UnwindSafe for VarianceThreshold
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> 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