-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Common types for sampling.
--   
--   Common types for implementing Markov Chain Monte Carlo (MCMC)
--   algorithms.
--   
--   An instance of an MCMC problem can be characterized by the following:
--   
--   <ul>
--   <li>A <i>target distribution</i> over some parameter space</li>
--   <li>A <i>parameter space</i> for a Markov chain to wander over</li>
--   <li>A <i>transition operator</i> to drive the Markov chain</li>
--   </ul>
--   
--   <i>mcmc-types</i> provides the suitably-general <a>Target</a>,
--   <a>Chain</a>, and <a>Transition</a> types for representing these
--   things respectively.
@package mcmc-types
@version 1.0.3


-- | Common types for implementing Markov Chain Monte Carlo (MCMC)
--   algorithms.
--   
--   <a>Target</a> is a product type intended to hold a log-target density
--   function and potentially its gradient.
--   
--   The <a>Chain</a> type represents a kind of annotated parameter space.
--   Technically all that's required here is the type of the parameter
--   space itself (held here in <a>chainPosition</a>) but in practice some
--   additional information is typically useful. Additionally there is
--   <a>chainScore</a> for holding the most recent score of the chain, as
--   well as the target itself for implementing things like annealing. The
--   <a>chainTunables</a> field can be used to hold arbitrary data.
--   
--   One should avoid exploiting these features to do something nasty
--   (like, say, invalidating the Markov property).
--   
--   The <a>Transition</a> type permits probabilistic transitions over some
--   state space by way of the underlying <a>Prob</a> monad.
module Data.Sampling.Types

-- | A generic transition operator.
--   
--   Has access to randomness via the underlying <a>Prob</a> monad.
type Transition m a = StateT a (Prob m) ()

-- | The <tt>Chain</tt> type specifies the state of a Markov chain at any
--   given iteration.
data Chain a b
Chain :: Target a -> !Double -> a -> Maybe b -> Chain a b
[chainTarget] :: Chain a b -> Target a
[chainScore] :: Chain a b -> !Double
[chainPosition] :: Chain a b -> a
[chainTunables] :: Chain a b -> Maybe b

-- | A <tt>Target</tt> consists of a function from parameter space to the
--   reals, as well as possibly a gradient.
--   
--   Most implementations assume a <i>log</i>-target, so records are named
--   accordingly.
data Target a
Target :: (a -> Double) -> Maybe (a -> a) -> Target a
[lTarget] :: Target a -> a -> Double
[glTarget] :: Target a -> Maybe (a -> a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Sampling.Types.Chain a b)
