pub struct Probability(/* private fields */);Expand description
A bounded probability value represented as fixed-point parts per million.
Unlike ConfidenceScore, this type can represent priors and conditional
likelihoods in Bayesian updates. The type enforces range and deterministic
arithmetic; it does not prove that a caller’s values were empirically
calibrated. Profiles using policy-selected weights must document that fact
rather than presenting their posteriors as measured real-world frequencies.
Floating-point conversion is provided only for display and analytics.
Implementations§
Source§impl Probability
impl Probability
Sourcepub fn from_parts_per_million(value: u32) -> Result<Self, ReasoningModelError>
pub fn from_parts_per_million(value: u32) -> Result<Self, ReasoningModelError>
Creates a probability from fixed-point parts per million.
Sourcepub fn from_basis_points(value: u16) -> Result<Self, ReasoningModelError>
pub fn from_basis_points(value: u16) -> Result<Self, ReasoningModelError>
Creates a probability from basis points.
Sourcepub fn from_percent(value: u8) -> Result<Self, ReasoningModelError>
pub fn from_percent(value: u8) -> Result<Self, ReasoningModelError>
Creates a probability from an integer percentage.
Sourcepub const fn parts_per_million(self) -> u32
pub const fn parts_per_million(self) -> u32
Returns the fixed-point value in parts per million.
Sourcepub fn update(
self,
likelihood_if_true: Self,
likelihood_if_false: Self,
) -> Result<Self, ReasoningModelError>
pub fn update( self, likelihood_if_true: Self, likelihood_if_false: Self, ) -> Result<Self, ReasoningModelError>
Applies one Bayesian observation to this prior.
likelihood_if_true is P(E|H) and likelihood_if_false is
P(E|not H). The result is rounded to the nearest part per million.
Trait Implementations§
Source§impl Clone for Probability
impl Clone for Probability
Source§fn clone(&self) -> Probability
fn clone(&self) -> Probability
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Probability
Source§impl Debug for Probability
impl Debug for Probability
Source§impl<'de> Deserialize<'de> for Probability
impl<'de> Deserialize<'de> for Probability
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>,
impl Eq for Probability
Source§impl Hash for Probability
impl Hash for Probability
Source§impl Ord for Probability
impl Ord for Probability
Source§fn cmp(&self, other: &Probability) -> Ordering
fn cmp(&self, other: &Probability) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for Probability
impl PartialEq for Probability
Source§impl PartialOrd for Probability
impl PartialOrd for Probability
Source§impl Serialize for Probability
impl Serialize for Probability
impl StructuralPartialEq for Probability
Auto Trait Implementations§
impl Freeze for Probability
impl RefUnwindSafe for Probability
impl Send for Probability
impl Sync for Probability
impl Unpin for Probability
impl UnsafeUnpin for Probability
impl UnwindSafe for Probability
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
§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
key and return true if they are equal.