| Copyright | (c) Adam Scibior 2015-2020 |
|---|---|
| License | MIT |
| Maintainer | leonhard.markert@tweag.io |
| Stability | experimental |
| Portability | GHC |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Control.Monad.Bayes.Sampler.Strict
Description
SamplerIO and SamplerST are instances of MonadDistribution. Apply a MonadFactor
transformer to obtain a MonadMeasure that can execute probabilistic models.
Synopsis
- data Sampler g m a
- type SamplerIO = Sampler (IOGenM StdGen) IO
- type SamplerST s = Sampler (STGenM StdGen s) (ST s)
- sampleIO :: SamplerIO a -> IO a
- sampleIOfixed :: SamplerIO a -> IO a
- sampleWith :: Sampler g m a -> g -> m a
- sampleSTfixed :: SamplerST s b -> ST s b
- sampleMean :: [(Double, Log Double)] -> Double
- sampler :: SamplerIO a -> IO a
Documentation
The sampling interpretation of a probabilistic program Here m is typically IO or ST
Instances
type SamplerIO = Sampler (IOGenM StdGen) IO Source #
convenient type synonym to show specializations of Sampler to particular pairs of monad and RNG
type SamplerST s = Sampler (STGenM StdGen s) (ST s) Source #
convenient type synonym to show specializations of Sampler to particular pairs of monad and RNG
sampleIOfixed :: SamplerIO a -> IO a Source #
Run the sampler with a fixed random seed
sampleWith :: Sampler g m a -> g -> m a Source #
Sample with a random number generator of your choice e.g. the one
from Random.
>>>import Control.Monad.Bayes.Class>>>import System.Random.Stateful hiding (random)>>>newIOGenM (mkStdGen 1729) >>= sampleWith random4.690861245089605e-2
sampleSTfixed :: SamplerST s b -> ST s b Source #
Run the sampler with a fixed random seed