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 = { to :: a -> b, from :: b -> a }

#Spread Source

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

#choose Source

choose :: forall a p. 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 a p. Semigroup p => Dist p Boolean -> Dist p a -> Dist p a -> Dist p a

#expected Source

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

#ffilter Source

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

#filter Source

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

#focus Source

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

#joinDists Source

joinDists :: forall a b c p. 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 a b p. EuclideanRing p => Ord a => Ord b => (NonEmpty Map a p -> NonEmpty Map b p) -> Dist p a -> Dist p b

#lookup Source

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

#map Source

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

#mapMaybe Source

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

#marginalize Source

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

#norm Source

norm :: forall a p. 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 a p. EuclideanRing p => Ord a => (a -> p) -> Spread p a

#reshape Source

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

#size Source

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

#stdDev Source

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

#toMap Source

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

#uniform Source

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

#variance Source

variance :: forall a p. 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)