pub struct StabilitySelector<E, State = Untrained> { /* private fields */ }Expand description
Stability selection using randomized feature selection with subsampling
Stability selection combines subsampling with feature selection algorithms to provide reproducible and stable feature selection results. It selects features that are consistently chosen across different bootstrap samples of the data.
Implementations§
Source§impl<E> StabilitySelector<E, Untrained>
impl<E> StabilitySelector<E, Untrained>
Sourcepub fn n_bootstrap(self, n_bootstrap: usize) -> Result<Self, SklearsError>
pub fn n_bootstrap(self, n_bootstrap: usize) -> Result<Self, SklearsError>
Set the number of bootstrap iterations
Sourcepub fn subsample_fraction(self, fraction: f64) -> Result<Self, SklearsError>
pub fn subsample_fraction(self, fraction: f64) -> Result<Self, SklearsError>
Set the fraction of samples to use in each bootstrap iteration
Sourcepub fn selection_threshold(self, threshold: f64) -> Result<Self, SklearsError>
pub fn selection_threshold(self, threshold: f64) -> Result<Self, SklearsError>
Set the threshold for feature selection stability Features selected in at least this fraction of bootstrap iterations are considered stable
Sourcepub fn max_features(self, max_features: Option<usize>) -> Self
pub fn max_features(self, max_features: Option<usize>) -> Self
Set maximum number of features to select (if None, all stable features are selected)
Sourcepub fn random_state(self, seed: u64) -> Self
pub fn random_state(self, seed: u64) -> Self
Set random state for reproducible results
Source§impl<E> StabilitySelector<E, Trained>
impl<E> StabilitySelector<E, Trained>
Sourcepub fn selection_probabilities(&self) -> SklResult<&Array1<Float>>
pub fn selection_probabilities(&self) -> SklResult<&Array1<Float>>
Get the selection probabilities for all features
Sourcepub fn stable_features(&self) -> SklResult<&[usize]>
pub fn stable_features(&self) -> SklResult<&[usize]>
Get the stable features
Sourcepub fn bootstrap_results(&self) -> SklResult<&[Vec<usize>]>
pub fn bootstrap_results(&self) -> SklResult<&[Vec<usize>]>
Get all bootstrap selection results for analysis
Sourcepub fn stability_score(&self) -> SklResult<f64>
pub fn stability_score(&self) -> SklResult<f64>
Calculate the stability score as the average selection probability of selected features
Sourcepub fn n_features(&self) -> SklResult<usize>
pub fn n_features(&self) -> SklResult<usize>
Get the number of features in the original dataset
Trait Implementations§
Source§impl<E> Estimator for StabilitySelector<E, Untrained>where
E: Estimator,
impl<E> Estimator for StabilitySelector<E, Untrained>where
E: Estimator,
Source§type Error = SklearsError
type Error = SklearsError
Source§fn validate_config(&self) -> Result<(), SklearsError>
fn validate_config(&self) -> Result<(), SklearsError>
Source§fn check_compatibility(
&self,
n_samples: usize,
n_features: usize,
) -> Result<(), SklearsError>
fn check_compatibility( &self, n_samples: usize, n_features: usize, ) -> Result<(), SklearsError>
Source§fn metadata(&self) -> EstimatorMetadata
fn metadata(&self) -> EstimatorMetadata
Source§impl<E> Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>, f64>> for StabilitySelector<E, Untrained>
impl<E> Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>, f64>> for StabilitySelector<E, Untrained>
Source§type Fitted = StabilitySelector<E, Trained>
type Fitted = StabilitySelector<E, Trained>
Source§fn fit(
self,
x: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>,
y: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>, f64>,
) -> SklResult<Self::Fitted>
fn fit( self, x: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>, y: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>, f64>, ) -> SklResult<Self::Fitted>
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,
Source§impl<E> Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>, ArrayBase<OwnedRepr<i32>, Dim<[usize; 1]>, i32>> for StabilitySelector<E, Untrained>
impl<E> Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>, ArrayBase<OwnedRepr<i32>, Dim<[usize; 1]>, i32>> for StabilitySelector<E, Untrained>
Source§type Fitted = StabilitySelector<E, Trained>
type Fitted = StabilitySelector<E, Trained>
Source§fn fit(
self,
x: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>,
y: &ArrayBase<OwnedRepr<i32>, Dim<[usize; 1]>, i32>,
) -> SklResult<Self::Fitted>
fn fit( self, x: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>, y: &ArrayBase<OwnedRepr<i32>, Dim<[usize; 1]>, i32>, ) -> SklResult<Self::Fitted>
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,
Source§impl<E> Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>, ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>, usize>> for StabilitySelector<E, Untrained>
impl<E> Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>, ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>, usize>> for StabilitySelector<E, Untrained>
Source§type Fitted = StabilitySelector<E, Trained>
type Fitted = StabilitySelector<E, Trained>
Source§fn fit(
self,
x: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>,
y: &ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>, usize>,
) -> SklResult<Self::Fitted>
fn fit( self, x: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>, f64>, y: &ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>, usize>, ) -> SklResult<Self::Fitted>
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,
Source§impl<E> SelectorMixin for StabilitySelector<E, Trained>
impl<E> SelectorMixin for StabilitySelector<E, Trained>
Auto Trait Implementations§
impl<E, State> Freeze for StabilitySelector<E, State>
impl<E, State> RefUnwindSafe for StabilitySelector<E, State>
impl<E, State> Send for StabilitySelector<E, State>
impl<E, State> Sync for StabilitySelector<E, State>
impl<E, State> Unpin for StabilitySelector<E, State>
impl<E, State> UnsafeUnpin for StabilitySelector<E, State>
impl<E, State> UnwindSafe for StabilitySelector<E, State>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> StableApi for Twhere
T: Estimator,
impl<T> StableApi for Twhere
T: Estimator,
Source§const STABLE_SINCE: &'static str = "0.1.0"
const STABLE_SINCE: &'static str = "0.1.0"
Source§const HAS_EXPERIMENTAL_FEATURES: bool = false
const HAS_EXPERIMENTAL_FEATURES: bool = false
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.