Safe Haskell | None |
---|---|
Language | Haskell2010 |
An IO-based sampling monad.
Synopsis
- data Sampler a
- liftS :: IO a -> Sampler a
- sampleIO :: Sampler a -> IO a
- sampleIOFixed :: Sampler a -> IO a
- createSampler :: (GenIO -> IO a) -> Sampler a
- sampleRandom :: GenIO -> IO Double
- sampleCauchy :: Double -> Double -> GenIO -> IO Double
- sampleNormal :: Double -> Double -> GenIO -> IO Double
- sampleUniform :: Double -> Double -> GenIO -> IO Double
- sampleDiscreteUniform :: Int -> Int -> GenIO -> IO Int
- sampleGamma :: Double -> Double -> GenIO -> IO Double
- sampleBeta :: Double -> Double -> GenIO -> IO Double
- sampleBernoulli :: Double -> GenIO -> IO Bool
- sampleBinomial :: Int -> Double -> GenIO -> IO [Bool]
- sampleCategorical :: Vector Double -> GenIO -> IO Int
- sampleDiscrete :: [Double] -> GenIO -> IO Int
- samplePoisson :: Double -> GenIO -> IO Int
- sampleDirichlet :: [Double] -> GenIO -> IO [Double]
Sampler monad
Sampler type, for running IO computations alongside a random number generator
sampleIO :: Sampler a -> IO a Source #
Takes a Sampler
, provides it a random generator, and runs the sampler in the IO
context
sampleIOFixed :: Sampler a -> IO a Source #
Takes a Sampler
, provides it a fixed generator, and runs the sampler in the IO
context
createSampler :: (GenIO -> IO a) -> Sampler a Source #
Takes a distribution which awaits a generator, and returns a Sampler
Sampling functions
Given their distribution parameters, these functions await a generator and
then sample a value from the distribution in the IO
monad.