pub struct MaybeUncertain<T: ProbabilisticType> { /* private fields */ }Expand description
A first-class type representing a value that is probabilistically present or absent. If the value is present, its own value is uncertain.
Implementations§
Source§impl MaybeUncertain<bool>
impl MaybeUncertain<bool>
pub fn from_uncertain(value: Uncertain<bool>) -> Self
Sourcepub fn from_value(value: bool) -> Self
pub fn from_value(value: bool) -> Self
Creates a new MaybeUncertain from a value that is certainly present and has a certain value.
Sourcepub fn always_none() -> Self
pub fn always_none() -> Self
Creates a new MaybeUncertain that is certainly absent.
Sourcepub fn from_bernoulli_and_uncertain(
prob_some: f64,
present_value_dist: Uncertain<bool>,
) -> Self
pub fn from_bernoulli_and_uncertain( prob_some: f64, present_value_dist: Uncertain<bool>, ) -> Self
Creates a MaybeUncertain where presence is determined by a Bernoulli trial.
Sourcepub fn sample(&self) -> Result<Option<bool>, UncertainError>
pub fn sample(&self) -> Result<Option<bool>, UncertainError>
Samples the MaybeUncertain value, returning Some(bool) if present or None if absent.
Sourcepub fn is_some(&self) -> Uncertain<bool>
pub fn is_some(&self) -> Uncertain<bool>
Returns an Uncertain<bool> representing the probability of the value being present.
Sourcepub fn is_none(&self) -> Uncertain<bool>
pub fn is_none(&self) -> Uncertain<bool>
Returns an Uncertain<bool> representing the probability of the value being absent.
Sourcepub fn lift_to_uncertain(
&self,
threshold_prob_some: f64,
confidence_level: f64,
epsilon: f64,
max_samples: usize,
) -> Result<Uncertain<bool>, UncertainError>
pub fn lift_to_uncertain( &self, threshold_prob_some: f64, confidence_level: f64, epsilon: f64, max_samples: usize, ) -> Result<Uncertain<bool>, UncertainError>
Converts the MaybeUncertain<bool> to a standard Uncertain<bool>.
This acts as a gate, returning Ok(Uncertain<bool>) only if the statistical evidence
for the value’s presence meets the specified threshold.
Source§impl MaybeUncertain<f64>
impl MaybeUncertain<f64>
Sourcepub fn from_uncertain(value: Uncertain<f64>) -> Self
pub fn from_uncertain(value: Uncertain<f64>) -> Self
Creates a new MaybeUncertain from a value that is certainly present but uncertain in value.
Sourcepub fn from_value(value: f64) -> Self
pub fn from_value(value: f64) -> Self
Creates a new MaybeUncertain from a value that is certainly present and has a certain value.
Sourcepub fn always_none() -> Self
pub fn always_none() -> Self
Creates a new MaybeUncertain that is certainly absent.
Sourcepub fn from_bernoulli_and_uncertain(
prob_some: f64,
present_value_dist: Uncertain<f64>,
) -> Self
pub fn from_bernoulli_and_uncertain( prob_some: f64, present_value_dist: Uncertain<f64>, ) -> Self
Creates a MaybeUncertain where presence is determined by a Bernoulli trial.
Sourcepub fn sample(&self) -> Result<Option<f64>, UncertainError>
pub fn sample(&self) -> Result<Option<f64>, UncertainError>
Samples the MaybeUncertain value, returning Some(f64) if present or None if absent.
Sourcepub fn is_some(&self) -> Uncertain<bool>
pub fn is_some(&self) -> Uncertain<bool>
Returns an Uncertain<bool> representing the probability of the value being present.
Sourcepub fn is_none(&self) -> Uncertain<bool>
pub fn is_none(&self) -> Uncertain<bool>
Returns an Uncertain<bool> representing the probability of the value being absent.
Sourcepub fn lift_to_uncertain(
&self,
threshold_prob_some: f64,
confidence_level: f64,
epsilon: f64,
max_samples: usize,
) -> Result<Uncertain<f64>, UncertainError>
pub fn lift_to_uncertain( &self, threshold_prob_some: f64, confidence_level: f64, epsilon: f64, max_samples: usize, ) -> Result<Uncertain<f64>, UncertainError>
Converts the MaybeUncertain<f64> to a standard Uncertain<f64>.
This acts as a gate, returning Ok(Uncertain<f64>) only if the statistical evidence
for the value’s presence meets the specified threshold.
Trait Implementations§
Source§impl Add for MaybeUncertain<f64>
impl Add for MaybeUncertain<f64>
Source§impl<T: Clone + ProbabilisticType> Clone for MaybeUncertain<T>
impl<T: Clone + ProbabilisticType> Clone for MaybeUncertain<T>
Source§fn clone(&self) -> MaybeUncertain<T>
fn clone(&self) -> MaybeUncertain<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more