Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This is a port of the implementation of LazyPPL: https://lazyppl.bitbucket.io/
Synopsis
- data Tree = Tree {}
- data Trees = Trees {}
- type Sampler = SamplerT Identity
- runSampler :: Sampler a -> Tree -> a
- newtype SamplerT m a = SamplerT {
- runSamplerT :: Tree -> m a
- splitTree :: Tree -> (Tree, Tree)
- randomTree :: RandomGen g => g -> Tree
- randomTrees :: RandomGen g => g -> Trees
- runSamplerTIO :: MonadIO m => SamplerT m a -> m a
- independent :: Monad m => m a -> m [a]
- weightedSamples :: MonadIO m => WeightedT (SamplerT m) a -> m [(a, Log Double)]
Documentation
A Tree
is a lazy, infinitely wide and infinitely deep tree, labelled by Doubles.
Our source of randomness will be a Tree, populated by uniform [0,1] choices for each label. Often people just use a list or stream instead of a tree. But a tree allows us to be lazy about how far we are going all the time.
type Sampler = SamplerT Identity Source #
A probability distribution over a
is a function 'Tree -> a'.
The idea is that it uses up bits of the tree as it runs.
runSampler :: Sampler a -> Tree -> a Source #
SamplerT | |
|
Instances
randomTree :: RandomGen g => g -> Tree Source #
Generate a tree with uniform random labels.
Preliminary for the simulation methods. This uses split
to split a random seed.
randomTrees :: RandomGen g => g -> Trees Source #
independent :: Monad m => m a -> m [a] Source #
Draw a stream of independent samples.