pub struct StreamingShap { /* private fields */ }Expand description
Running mean of absolute SHAP values for online feature importance tracking.
Feed SHAP explanations as they are computed during training/prediction, and query the running importance scores at any time.
§Example
let mut tracker = StreamingShap::new(n_features);
for sample in stream {
let shap = model.explain(&sample.features);
tracker.update(&shap);
}
let importances = tracker.importances(); // running mean |SHAP|Implementations§
Source§impl StreamingShap
impl StreamingShap
Sourcepub fn update(&mut self, shap: &ShapValues)
pub fn update(&mut self, shap: &ShapValues)
Update with a new SHAP explanation, incrementing the running mean.
Sourcepub fn importances(&self) -> &[f64]
pub fn importances(&self) -> &[f64]
Current running mean of |SHAP| per feature.
Trait Implementations§
Source§impl Clone for StreamingShap
impl Clone for StreamingShap
Source§fn clone(&self) -> StreamingShap
fn clone(&self) -> StreamingShap
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StreamingShap
impl RefUnwindSafe for StreamingShap
impl Send for StreamingShap
impl Sync for StreamingShap
impl Unpin for StreamingShap
impl UnsafeUnpin for StreamingShap
impl UnwindSafe for StreamingShap
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