pub struct BayesianBelief { /* private fields */ }Expand description
Deterministic Bayesian state for one hypothesis.
Evidence is stored and replayed in EvidenceId order. Inserting the same
set in a different arrival order therefore produces an identical posterior
and audit trail. Reusing an evidence identifier replaces its likelihoods
instead of double counting the observation.
Implementations§
Source§impl BayesianBelief
impl BayesianBelief
Sourcepub fn new(prior: Probability) -> Self
pub fn new(prior: Probability) -> Self
Starts a belief at the caller-supplied prior.
Sourcepub fn observe(
&mut self,
observation: BayesianEvidence,
) -> Result<BeliefWrite, ReasoningModelError>
pub fn observe( &mut self, observation: BayesianEvidence, ) -> Result<BeliefWrite, ReasoningModelError>
Adds or replaces one observation and recomputes the posterior.
The operation is transactional: an undefined update leaves the belief unchanged.
Sourcepub fn prior(&self) -> Probability
pub fn prior(&self) -> Probability
Returns the initial probability before observations.
Sourcepub fn posterior(&self) -> Probability
pub fn posterior(&self) -> Probability
Returns the current posterior probability.
Sourcepub fn evidence(&self) -> &[BayesianEvidence]
pub fn evidence(&self) -> &[BayesianEvidence]
Returns observations in deterministic evidence-identifier order.
Sourcepub fn updates(&self) -> &[BayesianUpdate]
pub fn updates(&self) -> &[BayesianUpdate]
Returns every intermediate Bayesian update in evaluation order.
Trait Implementations§
Source§impl Clone for BayesianBelief
impl Clone for BayesianBelief
Source§fn clone(&self) -> BayesianBelief
fn clone(&self) -> BayesianBelief
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 BayesianBelief
impl Debug for BayesianBelief
Source§impl<'de> Deserialize<'de> for BayesianBelief
impl<'de> Deserialize<'de> for BayesianBelief
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
impl Eq for BayesianBelief
Source§impl PartialEq for BayesianBelief
impl PartialEq for BayesianBelief
Source§impl Serialize for BayesianBelief
impl Serialize for BayesianBelief
impl StructuralPartialEq for BayesianBelief
Auto Trait Implementations§
impl Freeze for BayesianBelief
impl RefUnwindSafe for BayesianBelief
impl Send for BayesianBelief
impl Sync for BayesianBelief
impl Unpin for BayesianBelief
impl UnsafeUnpin for BayesianBelief
impl UnwindSafe for BayesianBelief
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.