monad-bayes-0.1.1.0: A library for probabilistic programming.
Copyright(c) Adam Scibior 2015-2020
LicenseMIT
Maintainerleonhard.markert@tweag.io
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Bayes.Enumerator

Description

 
Synopsis

Documentation

data Enumerator a Source #

An exact inference transformer that integrates discrete random variables by enumerating all execution paths.

Instances

Instances details
Monad Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

Methods

(>>=) :: Enumerator a -> (a -> Enumerator b) -> Enumerator b #

(>>) :: Enumerator a -> Enumerator b -> Enumerator b #

return :: a -> Enumerator a #

Functor Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

Methods

fmap :: (a -> b) -> Enumerator a -> Enumerator b #

(<$) :: a -> Enumerator b -> Enumerator a #

Applicative Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

Methods

pure :: a -> Enumerator a #

(<*>) :: Enumerator (a -> b) -> Enumerator a -> Enumerator b #

liftA2 :: (a -> b -> c) -> Enumerator a -> Enumerator b -> Enumerator c #

(*>) :: Enumerator a -> Enumerator b -> Enumerator b #

(<*) :: Enumerator a -> Enumerator b -> Enumerator a #

Alternative Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

MonadPlus Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

MonadInfer Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

MonadCond Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

Methods

score :: Log Double -> Enumerator () Source #

MonadSample Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

Ord a => Eq (Enumerator a) Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

Methods

(==) :: Enumerator a -> Enumerator a -> Bool #

(/=) :: Enumerator a -> Enumerator a -> Bool #

Ord a => AEq (Enumerator a) Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

Methods

(===) :: Enumerator a -> Enumerator a -> Bool #

(~==) :: Enumerator a -> Enumerator a -> Bool #

logExplicit :: Enumerator a -> [(a, Log Double)] Source #

Returns the posterior as a list of weight-value pairs without any post-processing, such as normalization or aggregation

explicit :: Enumerator a -> [(a, Double)] Source #

Same as toList, only weights are converted from log-domain.

evidence :: Enumerator a -> Log Double Source #

Returns the model evidence, that is sum of all weights.

mass :: Ord a => Enumerator a -> a -> Double Source #

Normalized probability mass of a specific value.

compact :: (Num r, Ord a) => [(a, r)] -> [(a, r)] Source #

Aggregate weights of equal values. The resulting list is sorted ascendingly according to values.

enumerate :: Ord a => Enumerator a -> [(a, Double)] Source #

Aggregate and normalize of weights. The resulting list is sorted ascendingly according to values.

enumerate = compact . explicit

expectation :: (a -> Double) -> Enumerator a -> Double Source #

Expectation of a given function computed using normalized weights.

normalForm :: Ord a => Enumerator a -> [(a, Double)] Source #

compact followed by removing values with zero weight.