pub struct Distribution { /* private fields */ }Expand description
Non-negative mass over declared options, summing to 1 within tolerance. Uncalibrated: it is not a calibrated probability.
Implementations§
Source§impl Distribution
impl Distribution
Sourcepub fn new(
options: &[String],
map: &BTreeMap<String, f64>,
tolerance: Decimal,
) -> Result<Self, KindError>
pub fn new( options: &[String], map: &BTreeMap<String, f64>, tolerance: Decimal, ) -> Result<Self, KindError>
Validate a supplied distribution. Stored as supplied, never renormalized.
Sourcepub fn from_logits(
options: &[String],
map: &BTreeMap<String, f64>,
tolerance: Decimal,
) -> Result<Self, KindError>
pub fn from_logits( options: &[String], map: &BTreeMap<String, f64>, tolerance: Decimal, ) -> Result<Self, KindError>
Normalize logits by softmax (design 8.2: the core normalizes logits, it never invents mass for a label backend).
pub fn options(&self) -> &[String]
pub fn masses(&self) -> &[f64]
pub fn mass(&self, option: &str) -> Option<f64>
Trait Implementations§
Source§impl Clone for Distribution
impl Clone for Distribution
Source§impl Debug for Distribution
impl Debug for Distribution
Source§impl PartialEq for Distribution
impl PartialEq for Distribution
impl StructuralPartialEq for Distribution
Auto Trait Implementations§
impl Freeze for Distribution
impl RefUnwindSafe for Distribution
impl Send for Distribution
impl Sync for Distribution
impl Unpin for Distribution
impl UnsafeUnpin for Distribution
impl UnwindSafe for Distribution
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