Skip to main content

PredictiveModel

Struct PredictiveModel 

Source
pub struct PredictiveModel { /* private fields */ }
Expand description

A predictive model that learns state transitions and rewards from experience.

This model enables an agent to forecast future states, predict rewards, and detect anomalies in its observations.

Implementations§

Source§

impl PredictiveModel

Source

pub fn new(config: PredictiveConfig) -> Self

Creates a new PredictiveModel with the given configuration.

Source

pub fn with_default_config() -> Self

Creates a PredictiveModel with a default configuration.

Source

pub fn record(&mut self, obs: &Observation)

Records an observation, updating the state history and anomaly detector.

Source

pub fn record_transition( &mut self, obs: &Observation, action: &Action, reward: f64, next_obs: &Observation, )

Records a full state transition (s, a, r, s').

Source

pub fn predict_next( &self, current: &Observation, action: &Action, ) -> PredictedState

Predicts the next state given the current state and an action.

Source

pub fn predict_trajectory( &self, start: &Observation, actions: &[Action], ) -> Trajectory

Predicts a trajectory of future states for a given sequence of actions.

Source

pub fn predict_reward(&self, state: &Observation, action: &Action) -> f64

Predicts the expected reward for taking a given action in a given state.

Source

pub fn is_anomaly(&self, obs: &Observation) -> bool

Returns true if the observation is considered anomalous based on historical data.

Source

pub fn get_confidence(&self, prediction: &PredictedState) -> f64

Returns the confidence score of a PredictedState.

Source

pub fn get_uncertainty(&self, state: &Observation) -> f64

Returns an estimate of the model’s uncertainty about a given state. This uses the anomaly score as a proxy for uncertainty.

Source

pub fn learn(&mut self)

Triggers the learning process for the model’s internal components.

Source

pub fn history(&self) -> &VecDeque<StateSnapshot>

Returns a reference to the recent history of state snapshots.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V