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.Sampler

Description

SamplerIO and SamplerST are instances of MonadSample. Apply a MonadCond transformer to obtain a MonadInfer that can execute probabilistic models.

Synopsis

Documentation

data SamplerIO a Source #

An IO based random sampler using the MWC-Random package.

Instances

Instances details
Monad SamplerIO Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler

Methods

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

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

return :: a -> SamplerIO a #

Functor SamplerIO Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler

Methods

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

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

Applicative SamplerIO Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler

Methods

pure :: a -> SamplerIO a #

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

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

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

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

MonadIO SamplerIO Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler

Methods

liftIO :: IO a -> SamplerIO a #

MonadSample SamplerIO Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler

sampleIO :: SamplerIO a -> IO a Source #

Initialize a pseudo-random number generator using randomness supplied by the operating system. For efficiency this operation should be applied at the very end, ideally once per program.

sampleIOfixed :: SamplerIO a -> IO a Source #

Like sampleIO, but with a fixed random seed. Useful for reproducibility.

sampleIOwith :: SamplerIO a -> GenIO -> IO a Source #

Like sampleIO but with a custom pseudo-random number generator.

data Seed #

An immutable snapshot of the state of a Gen.

Instances

Instances details
Eq Seed 
Instance details

Defined in System.Random.MWC

Methods

(==) :: Seed -> Seed -> Bool #

(/=) :: Seed -> Seed -> Bool #

Show Seed 
Instance details

Defined in System.Random.MWC

Methods

showsPrec :: Int -> Seed -> ShowS #

show :: Seed -> String #

showList :: [Seed] -> ShowS #

newtype SamplerST a Source #

An ST based random sampler using the mwc-random package.

Constructors

SamplerST (forall s. ReaderT (GenST s) (ST s) a) 

Instances

Instances details
Monad SamplerST Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler

Methods

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

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

return :: a -> SamplerST a #

Functor SamplerST Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler

Methods

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

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

Applicative SamplerST Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler

Methods

pure :: a -> SamplerST a #

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

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

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

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

MonadSample SamplerST Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler

sampleST :: SamplerST a -> State Seed a Source #

Run the sampler with a supplied seed. Note that 'State Seed' is much less efficient than SamplerST for composing computation.

sampleSTfixed :: SamplerST a -> a Source #

Run the sampler with a fixed random seed.