Predictor

Trait Predictor 

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

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§