pub struct BayesianEvidence { /* private fields */ }Expand description
Likelihoods contributed by one immutable evidence record.
§Example
use termivar_core::{BayesianEvidence, EvidenceId, Probability};
let observation = BayesianEvidence::new(
EvidenceId::parse("cookie-xsrf-token")?,
Probability::from_percent(80)?,
Probability::from_percent(20)?,
"XSRF-TOKEN is more likely when the framework is present",
)?;
assert_eq!(observation.likelihood_if_true().parts_per_million(), 800_000);Implementations§
Source§impl BayesianEvidence
impl BayesianEvidence
Sourcepub fn new(
evidence_id: EvidenceId,
likelihood_if_true: Probability,
likelihood_if_false: Probability,
rationale: impl Into<String>,
) -> Result<Self, ReasoningModelError>
pub fn new( evidence_id: EvidenceId, likelihood_if_true: Probability, likelihood_if_false: Probability, rationale: impl Into<String>, ) -> Result<Self, ReasoningModelError>
Creates one explainable likelihood observation.
Sourcepub fn evidence_id(&self) -> &EvidenceId
pub fn evidence_id(&self) -> &EvidenceId
Returns the referenced evidence identifier.
Sourcepub fn likelihood_if_true(&self) -> Probability
pub fn likelihood_if_true(&self) -> Probability
Returns P(E|H).
Sourcepub fn likelihood_if_false(&self) -> Probability
pub fn likelihood_if_false(&self) -> Probability
Returns P(E|not H).
Trait Implementations§
Source§impl Clone for BayesianEvidence
impl Clone for BayesianEvidence
Source§fn clone(&self) -> BayesianEvidence
fn clone(&self) -> BayesianEvidence
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 BayesianEvidence
impl Debug for BayesianEvidence
Source§impl<'de> Deserialize<'de> for BayesianEvidence
impl<'de> Deserialize<'de> for BayesianEvidence
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 BayesianEvidence
Source§impl PartialEq for BayesianEvidence
impl PartialEq for BayesianEvidence
Source§impl Serialize for BayesianEvidence
impl Serialize for BayesianEvidence
impl StructuralPartialEq for BayesianEvidence
Auto Trait Implementations§
impl Freeze for BayesianEvidence
impl RefUnwindSafe for BayesianEvidence
impl Send for BayesianEvidence
impl Sync for BayesianEvidence
impl Unpin for BayesianEvidence
impl UnsafeUnpin for BayesianEvidence
impl UnwindSafe for BayesianEvidence
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.