Module

Math.Probability

Package
purescript-probability
Repository
colehaus/purescript-probability

Provides monadic interface for computation with discrete random variables. Based on: http://web.engr.oregonstate.edu/~erwig/papers/PFP_JFP06.pdf

#Event Source

type Event a = a -> Boolean

#Iso Source

type Iso a b = { from :: b -> a, to :: a -> b }

#Spread Source

type Spread p a = NonEmpty Set a -> Dist p a

#choose Source

choose :: forall p a. Bounded p => Ring p => p -> a -> a -> Dist p a

#complement Source

complement :: forall p. Bounded p => Ring p => p -> p

#cond Source

cond :: forall p a. Semigroup p => Dist p Boolean -> Dist p a -> Dist p a -> Dist p a

#expected Source

expected :: forall p a. Ord a => Semiring a => Semiring p => (p -> a) -> Dist p a -> a

#ffilter Source

ffilter :: forall p a. Ord a => EuclideanRing p => Semiring p => Dist p a -> Event a -> Maybe (Dist p a)

#filter Source

filter :: forall p a. Ord a => EuclideanRing p => Semiring p => Event a -> Dist p a -> Maybe (Dist p a)

#focus Source

focus :: forall p a. Bounded p => EuclideanRing p => Ord a => a -> Spread p a

#joinDists Source

joinDists :: forall p c b a. Bounded p => Semigroup p => (a -> b -> c) -> Dist p a -> (a -> Dist p b) -> Dist p c

#just Source

just :: forall a. Eq a => a -> Event a

#lift Source

lift :: forall p b a. EuclideanRing p => Ord a => Ord b => (NonEmpty Map a p -> NonEmpty Map b p) -> Dist p a -> Dist p b

#lookup Source

lookup :: forall p a. Ord a => Semiring p => Event a -> Dist p a -> p

#map Source

map :: forall p b a. Ord b => Semiring p => (a -> b) -> Dist p a -> Dist p b

#mapMaybe Source

mapMaybe :: forall p b a. Ord a => Ord b => Semiring p => EuclideanRing p => (a -> Maybe b) -> Dist p a -> Maybe (Dist p b)

#marginalize Source

marginalize :: forall p b a. Ord a => Ord b => EuclideanRing p => (a -> b) -> Dist p a -> Dist p b

#norm Source

norm :: forall p a. Semiring p => Ord a => Dist p a -> Dist p a

#oneOf Source

oneOf :: forall a. Eq a => List a -> Event a

#relative Source

relative :: forall p a. EuclideanRing p => Ord a => (a -> p) -> Spread p a

#reshape Source

reshape :: forall p a. Ord a => Semiring p => Spread p a -> Dist p a -> Dist p a

#size Source

size :: forall p a. Ord a => Semiring p => Dist p a -> Int

#stdDev Source

stdDev :: forall p a. Ord a => Ring a => Semiring p => Iso a Number -> (p -> a) -> Dist p a -> a

#toMap Source

toMap :: forall k p. Ord k => Semiring p => NonEmpty Map k p -> Map k p

#uniform Source

uniform :: forall p a. Bounded p => EuclideanRing p => Ord a => Spread p a

#variance Source

variance :: forall p a. Ord a => Ring a => Semiring p => (p -> a) -> Dist p a -> a

#(>>=?) Source

Operator alias for Math.Probability.ffilter (left-associative / precedence 1)

#(?=<<) Source

Operator alias for Math.Probability.filter (right-associative / precedence 1)

#(??) Source

Operator alias for Math.Probability.lookup (right-associative / precedence 1)