0 | module Control.Monad.Bayes.Inference.PMMH
 1 |
 2 | import Control.Monad.Bayes.Interface
 3 | import Control.Monad.Bayes.Inference.SMC
 4 | import Control.Monad.Bayes.Population
 5 | import Control.Monad.Bayes.Sequential
 6 | import Control.Monad.Bayes.Traced.Static
 7 | import Control.Monad.Trans
 8 | import Numeric.Log
 9 |
10 | ||| Particle Marginal Metropolis-Hastings sampling.
11 | export
12 | pmmh :
13 |   MonadInfer m =>
14 |   -- | number of Metropolis-Hastings steps
15 |   (n_mhsteps : Nat) ->
16 |   -- | number of time steps
17 |   (n_timesteps : Nat) ->
18 |   -- | number of particles
19 |   (n_particles : Nat) ->
20 |   -- | model parameters prior
21 |   Traced m b ->
22 |   -- | model
23 |   (b -> Sequential (Population m) a) ->
24 |   m (Vect (S n_mhsteps) (List (Log Double, a)))
25 | pmmh n_mhsteps n_timesteps n_particles param model =
26 |   mh n_mhsteps (param >>= runPopulation . pushEvidence . Population.hoist lift . smcSystematic n_timesteps n_particles . model)
27 |