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