Skip to main content

ProbabilityInterval

Struct ProbabilityInterval 

Source
pub struct ProbabilityInterval {
    pub lower: f64,
    pub upper: f64,
}
Expand description

Probability interval representing imprecise probabilities.

Represents the set [lower, upper] of possible probability values. Follows the theory of imprecise probabilities and credal sets.

Fields§

§lower: f64

Lower probability bound (must be in [0, 1])

§upper: f64

Upper probability bound (must be in [0, 1] and >= lower)

Implementations§

Source§

impl ProbabilityInterval

Source

pub fn new(lower: f64, upper: f64) -> Option<Self>

Create a new probability interval.

Returns None if bounds are invalid (not in [0,1] or lower > upper).

Source

pub fn precise(prob: f64) -> Option<Self>

Create a precise probability (point interval).

Source

pub fn vacuous() -> Self

Create a vacuous interval [0, 1] (complete ignorance).

Source

pub fn width(&self) -> f64

Width of the interval (measure of imprecision).

Source

pub fn is_precise(&self) -> bool

Check if this is a precise probability.

Source

pub fn is_vacuous(&self) -> bool

Check if the interval is vacuous (completely imprecise).

Source

pub fn complement(&self) -> Self

Complement: P(¬A) given P(A).

Source

pub fn and(&self, other: &Self) -> Self

Conjunction bounds: P(A ∧ B) given P(A) and P(B).

Uses Fréchet bounds: max(0, P(A) + P(B) - 1) ≤ P(A ∧ B) ≤ min(P(A), P(B))

Source

pub fn or(&self, other: &Self) -> Self

Disjunction bounds: P(A ∨ B) given P(A) and P(B).

Uses Fréchet bounds: max(P(A), P(B)) ≤ P(A ∨ B) ≤ min(1, P(A) + P(B))

Source

pub fn implies(&self, other: &Self) -> Self

Implication bounds: P(A → B) given P(A) and P(B).

A → B ≡ ¬A ∨ B, so use complement and disjunction.

Source

pub fn conditional(&self, joint: &Self) -> Option<Self>

Conditional probability bounds: P(B|A) given P(A) and P(A ∧ B).

If P(A) > 0, returns P(A ∧ B) / P(A). Uses interval division: [a,b] / [c,d] = [a/d, b/c] for positive intervals.

Source

pub fn intersect(&self, other: &Self) -> Option<Self>

Intersection of two probability intervals.

Returns None if intervals don’t overlap.

Source

pub fn convex_combine(&self, other: &Self, weight: f64) -> Option<Self>

Convex combination of two intervals.

Useful for averaging or mixing probability assessments.

Trait Implementations§

Source§

impl Clone for ProbabilityInterval

Source§

fn clone(&self) -> ProbabilityInterval

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ProbabilityInterval

Source§

impl Debug for ProbabilityInterval

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ProbabilityInterval

Source§

fn eq(&self, other: &ProbabilityInterval) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ProbabilityInterval

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.