monad-bayes-0.1.0.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.Sequential

Description

Sequential represents a computation that can be suspended.

Synopsis

Documentation

data Sequential m a Source #

Represents a computation that can be suspended at certain points. The intermediate monadic effects can be extracted, which is particularly useful for implementation of Sequential Monte Carlo related methods. All the probabilistic effects are lifted from the transformed monad, but also suspend is inserted after each factor.

Instances
MonadTrans Sequential Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential

Methods

lift :: Monad m => m a -> Sequential m a #

Monad m => Monad (Sequential m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential

Methods

(>>=) :: Sequential m a -> (a -> Sequential m b) -> Sequential m b #

(>>) :: Sequential m a -> Sequential m b -> Sequential m b #

return :: a -> Sequential m a #

fail :: String -> Sequential m a #

Functor m => Functor (Sequential m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential

Methods

fmap :: (a -> b) -> Sequential m a -> Sequential m b #

(<$) :: a -> Sequential m b -> Sequential m a #

Monad m => Applicative (Sequential m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential

Methods

pure :: a -> Sequential m a #

(<*>) :: Sequential m (a -> b) -> Sequential m a -> Sequential m b #

liftA2 :: (a -> b -> c) -> Sequential m a -> Sequential m b -> Sequential m c #

(*>) :: Sequential m a -> Sequential m b -> Sequential m b #

(<*) :: Sequential m a -> Sequential m b -> Sequential m a #

MonadIO m => MonadIO (Sequential m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential

Methods

liftIO :: IO a -> Sequential m a #

MonadInfer m => MonadInfer (Sequential m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential

MonadCond m => MonadCond (Sequential m) Source #

Execution is suspended after each score.

Instance details

Defined in Control.Monad.Bayes.Sequential

Methods

score :: Log Double -> Sequential m () Source #

MonadSample m => MonadSample (Sequential m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential

suspend :: Monad m => Sequential m () Source #

A point where the computation is paused.

finish :: Monad m => Sequential m a -> m a Source #

Remove the remaining suspension points.

advance :: Monad m => Sequential m a -> Sequential m a Source #

Execute to the next suspension point. If the computation is finished, do nothing.

finish = finish . advance

finished :: Monad m => Sequential m a -> m Bool Source #

Return True if no more suspension points remain.

hoistFirst :: (forall x. m x -> m x) -> Sequential m a -> Sequential m a Source #

Transform the inner monad. This operation only applies to computation up to the first suspension.

hoist :: (Monad m, Monad n) => (forall x. m x -> n x) -> Sequential m a -> Sequential n a Source #

Transform the inner monad. The transformation is applied recursively through all the suspension points.

sis Source #

Arguments

:: Monad m 
=> (forall x. m x -> m x)

transformation

-> Int

number of time steps

-> Sequential m a 
-> m a 

Sequential importance sampling. Applies a given transformation after each time step.