Skip to main content

WrapperMethods

Struct WrapperMethods 

Source
pub struct WrapperMethods;
Expand description

Wrapper-based feature selection methods

Implementations§

Source§

impl WrapperMethods

Source

pub fn forward_selection( features: &Array2<f64>, target: &Array1<f64>, config: &FeatureSelectionConfig, ) -> Result<FeatureSelectionResult>

Forward feature selection

Starts with no features and iteratively adds the best feature.

§Arguments
  • features - Feature matrix (samples x features)
  • target - Target variable
  • config - Configuration for selection
§Returns
  • Feature selection result
§Example
use scirs2_core::ndarray::{Array1, Array2};
use scirs2_series::feature_selection::{WrapperMethods, FeatureSelectionConfig};

let features = Array2::from_shape_vec((100, 10), (0..1000).map(|x| x as f64).collect()).expect("Operation failed");
let target = Array1::from_vec((0..100).map(|x| x as f64).collect());
let config = FeatureSelectionConfig::default();

let result = WrapperMethods::forward_selection(&features, &target, &config).expect("Operation failed");
println!("Selected {} features", result.selected_features.len());
Source

pub fn backward_elimination( features: &Array2<f64>, target: &Array1<f64>, config: &FeatureSelectionConfig, ) -> Result<FeatureSelectionResult>

Backward feature elimination

Starts with all features and iteratively removes the worst feature.

§Arguments
  • features - Feature matrix (samples x features)
  • target - Target variable
  • config - Configuration for selection
§Returns
  • Feature selection result
Source

pub fn recursive_feature_elimination( features: &Array2<f64>, target: &Array1<f64>, config: &FeatureSelectionConfig, ) -> Result<FeatureSelectionResult>

Recursive feature elimination

Recursively eliminates features by fitting a model and removing the least important features.

§Arguments
  • features - Feature matrix (samples x features)
  • target - Target variable
  • config - Configuration for selection
§Returns
  • Feature selection result
Source

pub fn bidirectional_selection( features: &Array2<f64>, target: &Array1<f64>, config: &FeatureSelectionConfig, ) -> Result<FeatureSelectionResult>

Bidirectional feature selection

Combines forward selection and backward elimination.

§Arguments
  • features - Feature matrix (samples x features)
  • target - Target variable
  • config - Configuration for selection
§Returns
  • Feature selection result
Source

pub fn evaluate_feature_subset( features: &Array2<f64>, target: &Array1<f64>, feature_indices: &[usize], config: &FeatureSelectionConfig, ) -> Result<f64>

Evaluate the performance of a feature subset using the configured scoring method

Source

pub fn fit_predict_linear( features: &Array2<f64>, target: &Array1<f64>, ) -> Result<Array1<f64>>

Fit a linear regression model and return predictions

Source

pub fn fit_linear_regression( features: &Array2<f64>, target: &Array1<f64>, ) -> Result<Array1<f64>>

Fit a linear regression model and return coefficients

Source

pub fn solve_linear_system( a: &Array2<f64>, b: &Array1<f64>, ) -> Result<Array1<f64>>

Solve a linear system using Gaussian elimination with partial pivoting

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Ungil for T
where T: Send,