mcmc-synthesis-0.1.1.0: MCMC applied to probabilistic program synthesis

Language.Synthesis.Distribution

Synopsis

# Documentation

data Distr a Source

Represents a discrete probability distribution.

Constructors

 Distr Fieldssample :: forall g. RandomGen g => Rand g aSample a random item from the distribution. logProbability :: a -> DoubleCompute the log probability of a given value.

Negative infinity, the log of 0 probability.

sumByLogs :: [Double] -> DoubleSource

Computes (log . sum . map exp), with more numeric precision.

categorical :: Eq a => [(a, Double)] -> Distr aSource

A distribution from an (item, weight) list.

uniform :: Eq a => [a] -> Distr aSource

Uniform distribution.

randInt :: (Integral i, Random i) => (i, i) -> Distr iSource

A distribution over some integral type, inclusively between the 2 values.

replicate :: Int -> Distr a -> Distr [a]Source

Generate n independent draws from a distribution.

mix :: [(Distr a, Double)] -> Distr aSource

Given (distribution, weight) pairs, mix the distributions.

constant :: a -> Distr aSource

A distribution containing a single item.