OnlineBytePredictor

Trait OnlineBytePredictor 

Source
pub trait OnlineBytePredictor: Send + OnlineBytePredictorClone {
    // Required methods
    fn log_prob(&mut self, symbol: u8) -> f64;
    fn update(&mut self, symbol: u8);

    // Provided methods
    fn begin_stream(
        &mut self,
        _total_symbols: Option<u64>,
    ) -> Result<(), String> { ... }
    fn finish_stream(&mut self) -> Result<(), String> { ... }
    fn fill_log_probs(&mut self, out: &mut [f64; 256]) { ... }
    fn log_prob_update(&mut self, symbol: u8) -> f64 { ... }
    fn reset_frozen(&mut self, total_symbols: Option<u64>) -> Result<(), String> { ... }
    fn update_frozen(&mut self, symbol: u8) { ... }
}
Expand description

Trait for online byte-level predictors that expose per-symbol log-probabilities.

Required Methods§

Source

fn log_prob(&mut self, symbol: u8) -> f64

Log-probability (natural log) of symbol given the current history.

Source

fn update(&mut self, symbol: u8)

Update the predictor with the observed symbol.

Provided Methods§

Source

fn begin_stream(&mut self, _total_symbols: Option<u64>) -> Result<(), String>

Optional stream-start hook.

Predictors that require total symbol count (for example percent-based policy schedules) can initialize runtime state here.

Source

fn finish_stream(&mut self) -> Result<(), String>

Optional stream-finalization hook.

Source

fn fill_log_probs(&mut self, out: &mut [f64; 256])

Bulk 256-way log-probabilities for the next byte.

Source

fn log_prob_update(&mut self, symbol: u8) -> f64

Log-probability (natural log) of symbol, then update the predictor.

Source

fn reset_frozen(&mut self, total_symbols: Option<u64>) -> Result<(), String>

Reset only dynamic conditioning state while preserving fitted parameters/statistics.

Predictors with latent/posterior state may also preserve their learned parameter posterior here; “frozen” means no new parameter fitting during the score pass, not necessarily a static hidden-state belief.

Source

fn update_frozen(&mut self, symbol: u8)

Advance conditioning state without fitting or adapting parameters.

For state-space or latent-variable models this may still update internal filtering/posterior state needed for correct sequential predictions.

Trait Implementations§

Source§

impl Clone for Box<dyn OnlineBytePredictor>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§