pub struct SensitivityAnalyzer { /* private fields */ }Expand description
Measures feature importance via finite-difference sensitivity analysis.
Implementations§
Source§impl SensitivityAnalyzer
impl SensitivityAnalyzer
Sourcepub fn input_sensitivity<F>(
&self,
input: &Array1<f32>,
forward_fn: F,
eps: f32,
) -> ModelResult<Array1<f32>>
pub fn input_sensitivity<F>( &self, input: &Array1<f32>, forward_fn: F, eps: f32, ) -> ModelResult<Array1<f32>>
Estimate per-feature sensitivity using finite differences.
For each feature i, computes ||f(x + eps*e_i) - f(x)|| / eps.
§Arguments
input— base input vector (length must equalinput_dim)forward_fn— model forward pass (calledinput_dim + 1times)eps— perturbation magnitude (default 1e-3 is reasonable)
Sourcepub fn rank_features<F>(
&self,
inputs: &[Array1<f32>],
forward_fn: F,
eps: f32,
) -> ModelResult<Vec<(usize, f32)>>
pub fn rank_features<F>( &self, inputs: &[Array1<f32>], forward_fn: F, eps: f32, ) -> ModelResult<Vec<(usize, f32)>>
Rank features by average sensitivity across multiple input vectors.
Returns a sorted list of (feature_index, avg_sensitivity) in descending order.
Auto Trait Implementations§
impl Freeze for SensitivityAnalyzer
impl RefUnwindSafe for SensitivityAnalyzer
impl Send for SensitivityAnalyzer
impl Sync for SensitivityAnalyzer
impl Unpin for SensitivityAnalyzer
impl UnsafeUnpin for SensitivityAnalyzer
impl UnwindSafe for SensitivityAnalyzer
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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