pub struct ContextNode {
pub counts: HashMap<String, usize>,
pub probabilities: HashMap<String, f64>,
pub entropy: f64,
pub kl_divergence: f64,
}Expand description
A node in the context tree that stores transition statistics
Fields§
§counts: HashMap<String, usize>Raw transition counts for each next state
probabilities: HashMap<String, f64>Normalized transition probabilities
entropy: f64Shannon entropy of the transition distribution
kl_divergence: f64KL divergence from uniform distribution
Implementations§
Source§impl ContextNode
impl ContextNode
Sourcepub fn add_transition(&mut self, next_state: String)
pub fn add_transition(&mut self, next_state: String)
Add a transition to this context
Sourcepub fn calculate_probabilities(&mut self, config: &AnomalyGridConfig)
pub fn calculate_probabilities(&mut self, config: &AnomalyGridConfig)
Calculate probabilities and information-theoretic measures
Trait Implementations§
Source§impl Clone for ContextNode
impl Clone for ContextNode
Source§fn clone(&self) -> ContextNode
fn clone(&self) -> ContextNode
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextNode
impl Debug for ContextNode
Auto Trait Implementations§
impl Freeze for ContextNode
impl RefUnwindSafe for ContextNode
impl Send for ContextNode
impl Sync for ContextNode
impl Unpin for ContextNode
impl UnwindSafe for ContextNode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more