pub trait Predictor: Send + Sync {
// Required methods
fn predict(&self, input: &[f32]) -> Result<Vec<usize>>;
fn calibrate(
&mut self,
samples: &[Vec<f32>],
activations: &[Vec<f32>],
) -> Result<()>;
fn stats(&self) -> PredictorStats;
}Expand description
Trait for activation predictors.
Required Methods§
Sourcefn predict(&self, input: &[f32]) -> Result<Vec<usize>>
fn predict(&self, input: &[f32]) -> Result<Vec<usize>>
Predict active neurons for the given input.
Returns a vector of neuron indices that are predicted to be active.
Sourcefn calibrate(
&mut self,
samples: &[Vec<f32>],
activations: &[Vec<f32>],
) -> Result<()>
fn calibrate( &mut self, samples: &[Vec<f32>], activations: &[Vec<f32>], ) -> Result<()>
Calibrate the predictor using sample data.
§Arguments
samples- Input samplesactivations- Corresponding activation patterns
Sourcefn stats(&self) -> PredictorStats
fn stats(&self) -> PredictorStats
Get predictor statistics.