sklears_feature_selection/base.rs
1//! Base classes for feature selection
2
3use scirs2_core::ndarray::{Array1, Array2};
4use sklears_core::{error::Result as SklResult, traits::Transform};
5
6/// Base trait for feature selectors
7pub trait SelectorMixin: Transform<Array2<f64>> {
8 /// Get support mask
9 fn get_support(&self) -> SklResult<Array1<bool>>;
10
11 /// Transform by selecting features
12 fn transform_features(&self, indices: &[usize]) -> SklResult<Vec<usize>>;
13}
14
15/// Trait for getting selected feature indices from trained selectors
16pub trait FeatureSelector {
17 /// Get selected feature indices
18 fn selected_features(&self) -> &Vec<usize>;
19}