pub trait Predictor: Send + Sync {
// 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 update_history(&mut self, sym: bool) { ... }
fn pop_history(&mut self) { ... }
fn predict_one(&mut self) -> f64 { ... }
}Expand description
Interface for an AIXI world model.
A predictor must be able to update its internal state based on observed symbols, revert its state for Monte Carlo simulations, and provide probabilities for
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 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 pop_history(&mut self)
fn pop_history(&mut self)
Reverts the model to its state before the last update_history.
Sourcefn predict_one(&mut self) -> f64
fn predict_one(&mut self) -> f64
Shorthand for predict_prob(true).