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

### #EventSource

``type Event a = a -> Boolean``

### #IsoSource

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

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

### #chooseSource

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

### #complementSource

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

### #condSource

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

### #expectedSource

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

### #ffilterSource

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

### #filterSource

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

### #focusSource

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

### #joinDistsSource

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

### #justSource

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

### #liftSource

``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``

### #lookupSource

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

### #mapSource

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

### #mapMaybeSource

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

### #marginalizeSource

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

### #normSource

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

### #oneOfSource

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

### #relativeSource

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

### #reshapeSource

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

### #sizeSource

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

### #stdDevSource

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

### #toMapSource

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

### #uniformSource

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

### #varianceSource

``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)