pub struct QValue {
pub mean: f64,
pub variance: f64,
pub update_count: u64,
pub last_updated: Timestamp,
}Expand description
Represents the learned value (Q-value) of a state-action pair, with associated statistics.
Fields§
§mean: f64The mean learned value for this state-action pair.
variance: f64The variance of the Q-value, indicating uncertainty.
update_count: u64The number of times this Q-value has been updated.
last_updated: TimestampThe timestamp of the last update.
Implementations§
Source§impl QValue
impl QValue
Sourcepub fn update(&mut self, new_value: f64, learning_rate: f64)
pub fn update(&mut self, new_value: f64, learning_rate: f64)
Updates the Q-value using a new sample and a learning rate. This uses Welford’s algorithm for incremental variance calculation.
Sourcepub fn confidence(&self) -> Confidence
pub fn confidence(&self) -> Confidence
Returns the confidence in this Q-value, based on update count and variance.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for QValue
impl<'de> Deserialize<'de> for QValue
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for QValue
impl RefUnwindSafe for QValue
impl Send for QValue
impl Sync for QValue
impl Unpin for QValue
impl UnsafeUnpin for QValue
impl UnwindSafe for QValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more