- discrete :: Distribution (Discrete p) a => [(p, a)] -> RVar a
- empirical :: (Num p, Ord a) => [a] -> Discrete p a
- newtype Discrete p a = Discrete [(p, a)]
- mapDiscreteWeights :: (p -> q) -> Discrete p e -> Discrete q e
- normalizeDiscreteWeights :: Fractional p => Discrete p e -> Discrete p e
- collectDiscreteEvents :: (Ord e, Num p, Ord p) => Discrete p e -> Discrete p e
- collectDiscreteEventsBy :: (e -> e -> Ordering) -> ([p] -> p) -> ([e] -> e) -> Discrete p e -> Discrete p e

# Documentation

discrete :: Distribution (Discrete p) a => [(p, a)] -> RVar aSource

Discrete [(p, a)] |

mapDiscreteWeights :: (p -> q) -> Discrete p e -> Discrete q eSource

Like `fmap`

, but for the weights of a discrete distribution.

normalizeDiscreteWeights :: Fractional p => Discrete p e -> Discrete p eSource

Adjust all the weights of a discrete distribution so that they sum to unity. If not possible, returns the original distribution unchanged.

collectDiscreteEvents :: (Ord e, Num p, Ord p) => Discrete p e -> Discrete p eSource

Simplify a discrete distribution by combining equivalent events (the new event will have a weight equal to the sum of all the originals).

collectDiscreteEventsBy :: (e -> e -> Ordering) -> ([p] -> p) -> ([e] -> e) -> Discrete p e -> Discrete p eSource

Simplify a discrete distribution by combining equivalent events (the new event will have a weight equal to the sum of all the originals). The comparator function is used to identify events to combine. Once chosen, the events and their weights are combined (independently) by the provided weight and event aggregation functions.