Skip to main content

StreamingPreprocessor

Trait StreamingPreprocessor 

Source
pub trait StreamingPreprocessor: Send + Sync {
    // Required methods
    fn update_and_transform(&mut self, features: &[f64]) -> Vec<f64>;
    fn transform(&self, features: &[f64]) -> Vec<f64>;
    fn output_dim(&self) -> Option<usize>;
    fn reset(&mut self);
}
Expand description

Object-safe trait for streaming feature transformers.

A StreamingPreprocessor maintains running statistics that are updated during training and applied (without update) during prediction. This separation ensures test-time transforms use frozen statistics.

§Object Safety

All methods use &self / &mut self with concrete return types, allowing Box<dyn StreamingPreprocessor> for runtime-polymorphic pipelines.

§Implementors

Required Methods§

Source

fn update_and_transform(&mut self, features: &[f64]) -> Vec<f64>

Update internal statistics from this sample and return transformed features.

Called during training. The preprocessor incorporates the sample into its running statistics (e.g., mean/variance) and returns the transformed features for the next pipeline stage.

Source

fn transform(&self, features: &[f64]) -> Vec<f64>

Transform features using current statistics without updating them.

Called during prediction. Statistics remain frozen so that test-time behaviour is deterministic with respect to the training data seen so far.

Source

fn output_dim(&self) -> Option<usize>

Number of output features, or None if unknown until the first sample.

Source

fn reset(&mut self)

Reset to initial (untrained) state.

Implementors§