#[non_exhaustive]pub struct SelectKBest { /* private fields */ }Expand description
Select the top-k highest-scoring features.
Uses a scoring function (e.g. ANOVA F-value) to rank features by their
discriminative power, then keeps only the k best.
§Examples
ⓘ
use scry_learn::prelude::*;
let mut sel = SelectKBest::new(ScoreFn::FClassif).k(2);
sel.fit(&data)?;
sel.transform(&mut data)?;
assert_eq!(data.n_features(), 2);Implementations§
Source§impl SelectKBest
impl SelectKBest
Sourcepub fn new(score_fn: ScoreFn) -> Self
pub fn new(score_fn: ScoreFn) -> Self
Create a new selector with the given scoring function.
Default: keep top 10 features.
Sourcepub fn scores(&self) -> &[f64]
pub fn scores(&self) -> &[f64]
Per-feature scores computed during fit.
Higher values indicate more discriminative features.
Sourcepub fn get_support(&self) -> &[bool]
pub fn get_support(&self) -> &[bool]
Boolean mask of selected features.
true at index j means feature j was kept.
Trait Implementations§
Source§impl Clone for SelectKBest
impl Clone for SelectKBest
Source§fn clone(&self) -> SelectKBest
fn clone(&self) -> SelectKBest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SelectKBest
impl Debug for SelectKBest
Auto Trait Implementations§
impl Freeze for SelectKBest
impl RefUnwindSafe for SelectKBest
impl Send for SelectKBest
impl Sync for SelectKBest
impl Unpin for SelectKBest
impl UnsafeUnpin for SelectKBest
impl UnwindSafe for SelectKBest
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