probly
Types
Represents the outcome of a probabilistic event as a collection of all possible values, tagged with their likelihood.
pub type Dist(a) =
List(#(a, Prob))
Functions
pub fn combine_dist(
dist1: List(#(a, Float)),
dist2: List(#(b, Float)),
) -> List(#(#(a, b), Float))
Combine distributions, assuming independence.
pub fn combine_dist_normalized(
dist1: List(#(a, Float)),
dist2: List(#(b, Float)),
) -> List(#(#(a, b), Float))
Normalize the combinination two Dist
s.
pub fn normalize(dist: List(#(a, Float))) -> List(#(a, Float))
Merge duplicates in a distribution by summing probabilities. “normalize” is a bit overloaded, this function does not ensure that the sum of all probabilities across a Dist is 1.
pub fn probability_of_event(
event: fn(a) -> Bool,
dist: List(#(a, Float)),
) -> Float
Retrieve the probability of an Event within a Dist occuring.