pub trait Predictor: Send {
// Required methods
fn update(&mut self, sym: bool);
fn revert(&mut self);
fn predict_prob(&mut self, sym: bool) -> f64;
fn model_name(&self) -> String;
fn boxed_clone(&self) -> Box<dyn Predictor>;
// Provided methods
fn commit_update(&mut self, sym: bool) { ... }
fn update_history(&mut self, sym: bool) { ... }
fn commit_update_history(&mut self, sym: bool) { ... }
fn pop_history(&mut self) { ... }
fn begin_rollback_scope(&mut self) { ... }
fn rollback_scope(&mut self) -> bool { ... }
fn predict_one(&mut self) -> f64 { ... }
}Expand description
Interface for an AIXI world model.
Predictors are mutated behind &mut self and cloned per worker during
parallel MCTS. They only need Send, not Sync, which avoids unsound
thread-sharing requirements for backends with thread-confined internals.
Required Methods§
Sourcefn predict_prob(&mut self, sym: bool) -> f64
fn predict_prob(&mut self, sym: bool) -> f64
Predicts the probability of the next symbol being sym.
Sourcefn model_name(&self) -> String
fn model_name(&self) -> String
Returns a human-readable name of the predictive model.
Sourcefn boxed_clone(&self) -> Box<dyn Predictor>
fn boxed_clone(&self) -> Box<dyn Predictor>
Creates a boxed clone of this predictor.
Provided Methods§
Sourcefn commit_update(&mut self, sym: bool)
fn commit_update(&mut self, sym: bool)
Incorporates a new symbol as committed training history without retaining rollback state when the predictor supports that optimization.
Sourcefn update_history(&mut self, sym: bool)
fn update_history(&mut self, sym: bool)
Appends a symbol to the model’s interaction history without necessarily updating the training counts immediately (backend dependent).
Sourcefn commit_update_history(&mut self, sym: bool)
fn commit_update_history(&mut self, sym: bool)
Appends a symbol as committed interaction history without retaining rollback state when the predictor supports that optimization.
Sourcefn pop_history(&mut self)
fn pop_history(&mut self)
Reverts the model to its state before the last update_history.
Sourcefn begin_rollback_scope(&mut self)
fn begin_rollback_scope(&mut self)
Begins an optional coarse rollback scope for simulation-heavy callers.
Predictors that support this can avoid retaining per-symbol rollback state
until the matching rollback_scope call.
Sourcefn rollback_scope(&mut self) -> bool
fn rollback_scope(&mut self) -> bool
Rolls back to the last scope opened with begin_rollback_scope.
Returns true when a scope rollback was performed, allowing callers to skip
per-symbol revert loops.
Sourcefn predict_one(&mut self) -> f64
fn predict_one(&mut self) -> f64
Shorthand for predict_prob(true).
Implementors§
impl Predictor for CtwPredictor
impl Predictor for FacCtwPredictor
impl Predictor for MambaPredictor
backend-mamba only.impl Predictor for RateBackendBitPredictor
impl Predictor for RosaPredictor
impl Predictor for RwkvPredictor
backend-rwkv only.