Predictor

Trait Predictor 

Source
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 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.

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§

Source

fn update(&mut self, sym: bool)

Incorporates a new symbol into the model’s training history.

Source

fn revert(&mut self)

Reverts the model to its state before the last update.

Source

fn predict_prob(&mut self, sym: bool) -> f64

Predicts the probability of the next symbol being sym.

Source

fn model_name(&self) -> String

Returns a human-readable name of the predictive model.

Source

fn boxed_clone(&self) -> Box<dyn Predictor>

Creates a boxed clone of this predictor.

Provided Methods§

Source

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).

Source

fn pop_history(&mut self)

Reverts the model to its state before the last update_history.

Source

fn predict_one(&mut self) -> f64

Shorthand for predict_prob(true).

Implementors§

Source§

impl Predictor for CtwPredictor

Source§

impl Predictor for FacCtwPredictor

Source§

impl Predictor for MambaPredictor

Available on crate feature backend-mamba only.
Source§

impl Predictor for RateBackendBitPredictor

Source§

impl Predictor for RosaPredictor

Source§

impl Predictor for RwkvPredictor

Available on crate feature backend-rwkv only.
Source§

impl Predictor for ZpaqPredictor