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§
Provided Methods§
Sourcefn begin_stream(&mut self, _total_symbols: Option<u64>) -> Result<(), String>
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.
Sourcefn finish_stream(&mut self) -> Result<(), String>
fn finish_stream(&mut self) -> Result<(), String>
Optional stream-finalization hook.
Sourcefn fill_log_probs(&mut self, out: &mut [f64; 256])
fn fill_log_probs(&mut self, out: &mut [f64; 256])
Bulk 256-way log-probabilities for the next byte.
Sourcefn log_prob_update(&mut self, symbol: u8) -> f64
fn log_prob_update(&mut self, symbol: u8) -> f64
Log-probability (natural log) of symbol, then update the predictor.
Sourcefn reset_frozen(&mut self, total_symbols: Option<u64>) -> Result<(), String>
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.
Sourcefn update_frozen(&mut self, symbol: u8)
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.