Copyright | (c) Adam Scibior 2015-2020 |
---|---|
License | MIT |
Maintainer | leonhard.markert@tweag.io |
Stability | experimental |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Density
is a free monad transformer over random sampling.
Synopsis
- data Density m a
- hoist :: (Monad m, Monad n) => (forall x. m x -> n x) -> Density m a -> Density n a
- interpret :: MonadDistribution m => Density m a -> m a
- withRandomness :: Monad m => [Double] -> Density m a -> m a
- density :: MonadDistribution m => [Double] -> Density m a -> m (a, [Double])
- traced :: MonadDistribution m => [Double] -> Density Identity a -> m (a, [Double])
Documentation
Free monad transformer over random sampling.
Uses the Church-encoded version of the free monad for efficiency.
Instances
MonadTrans Density Source # | |
Defined in Control.Monad.Bayes.Density.Free | |
Applicative (Density m) Source # | |
Defined in Control.Monad.Bayes.Density.Free | |
Functor (Density m) Source # | |
Monad (Density m) Source # | |
Monad m => MonadDistribution (Density m) Source # | |
Defined in Control.Monad.Bayes.Density.Free random :: Density m Double Source # uniform :: Double -> Double -> Density m Double Source # normal :: Double -> Double -> Density m Double Source # gamma :: Double -> Double -> Density m Double Source # beta :: Double -> Double -> Density m Double Source # bernoulli :: Double -> Density m Bool Source # categorical :: Vector v Double => v Double -> Density m Int Source # logCategorical :: (Vector v (Log Double), Vector v Double) => v (Log Double) -> Density m Int Source # uniformD :: [a] -> Density m a Source # geometric :: Double -> Density m Int Source # poisson :: Double -> Density m Int Source # dirichlet :: Vector v Double => v Double -> Density m (v Double) Source # |
hoist :: (Monad m, Monad n) => (forall x. m x -> n x) -> Density m a -> Density n a Source #
Hoist Density
through a monad transform.
interpret :: MonadDistribution m => Density m a -> m a Source #
Execute random sampling in the transformed monad.
withRandomness :: Monad m => [Double] -> Density m a -> m a Source #
Execute computation with supplied values for random choices.