pub struct BrainState {
pub parameters: HashMap<String, BetaPosterior>,
pub entity_posteriors: EntityPosteriors,
pub total_events: u64,
pub exploration_epoch: u64,
}Expand description
Runtime brain state — not directly serializable (contains LRU).
Fields§
§parameters: HashMap<String, BetaPosterior>§entity_posteriors: EntityPosteriors§total_events: u64§exploration_epoch: u64Implementations§
Source§impl BrainState
impl BrainState
pub fn new( parameters: HashMap<String, BetaPosterior>, entity_capacity: usize, ) -> Self
pub fn to_snapshot(&self) -> BrainStateSnapshot
pub fn from_snapshot( snapshot: BrainStateSnapshot, entity_capacity: usize, ) -> Self
pub fn reset_posteriors(&mut self)
Trait Implementations§
Source§impl Fold<Event, BrainState> for EventFold
impl Fold<Event, BrainState> for EventFold
Source§fn initial(&self, _context: &FoldContext) -> BrainState
fn initial(&self, _context: &FoldContext) -> BrainState
Get the initial state before any entries are processed.
Source§fn step(
&self,
state: BrainState,
event: &Event,
_ctx: &FoldContext,
) -> BrainState
fn step( &self, state: BrainState, event: &Event, _ctx: &FoldContext, ) -> BrainState
Process a single entry and return the new state. Read more
Source§fn finalize(&self, state: BrainState, _context: &FoldContext) -> BrainState
fn finalize(&self, state: BrainState, _context: &FoldContext) -> BrainState
Finalize the state after all entries are processed. Read more
Source§fn derive<'a, I>(&self, entries: I, context: &FoldContext) -> FoldOutcome<S>
fn derive<'a, I>(&self, entries: I, context: &FoldContext) -> FoldOutcome<S>
Derive state from an iterator of entries. Read more
Source§fn derive_filtered<'a, I, F>(
&self,
entries: I,
context: &FoldContext,
filter: F,
) -> FoldOutcome<S>
fn derive_filtered<'a, I, F>( &self, entries: I, context: &FoldContext, filter: F, ) -> FoldOutcome<S>
Derive state with a filter.
Auto Trait Implementations§
impl Freeze for BrainState
impl RefUnwindSafe for BrainState
impl Send for BrainState
impl Sync for BrainState
impl Unpin for BrainState
impl UnsafeUnpin for BrainState
impl UnwindSafe for BrainState
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