pub trait Explainable {
type Path: DecisionPath;
// Required methods
fn predict_explained(
&self,
x: &[f32],
n_samples: usize,
) -> (Vec<f32>, Vec<Self::Path>);
fn explain_one(&self, sample: &[f32]) -> Self::Path;
}Expand description
Trait for models that can explain their predictions
Required Associated Types§
Sourcetype Path: DecisionPath
type Path: DecisionPath
Model-specific decision path type
Required Methods§
Sourcefn predict_explained(
&self,
x: &[f32],
n_samples: usize,
) -> (Vec<f32>, Vec<Self::Path>)
fn predict_explained( &self, x: &[f32], n_samples: usize, ) -> (Vec<f32>, Vec<Self::Path>)
Predict with full decision trace for each sample
Sourcefn explain_one(&self, sample: &[f32]) -> Self::Path
fn explain_one(&self, sample: &[f32]) -> Self::Path
Single-sample explanation (for streaming)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".