monad-bayes-1.1.1: A library for probabilistic programming.
Copyright(c) Adam Scibior 2015-2020
LicenseMIT
Maintainerleonhard.markert@tweag.io
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
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
Alternative Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

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 #

Functor Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

Methods

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

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

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 #

MonadPlus Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

MonadDistribution Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

MonadFactor Enumerator Source # 
Instance details

Defined in Control.Monad.Bayes.Enumerator

Methods

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

MonadMeasure 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, Ord r) => [(a, r)] -> [(a, r)] Source #

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

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

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

enumerator = compact . explicit

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

deprecated synonym

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

enumerator = 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.

toEmpirical :: (Fractional b, Ord a, Ord b) => [a] -> [(a, b)] Source #

toEmpiricalWeighted :: (Fractional b, Ord a, Ord b) => [(a, b)] -> [(a, b)] Source #

normalizeWeights :: Fractional b => [(a, b)] -> [(a, b)] Source #

Divide all weights by their sum.

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

Construct Enumerator from a list of values and associated weights.