deanie

An embedded probabilistic programming language.
git clone git://git.jtobin.io/deanie.git
Log | Files | Refs | README | LICENSE

BetaBernoulliMetropolis.hs (343B)


      1 
      2 module Main where
      3 
      4 import Deanie
      5 import Model.BetaBernoulli as Model
      6 
      7 posterior :: Double -> Double -> Program [Double]
      8 posterior a b =
      9   metropolis 1000 Model.observations (beta a b) logDensityBernoulli
     10 
     11 main :: IO ()
     12 main = do
     13   samples <- sample (rvar (posterior 1 1))
     14   mapM_ print samples
     15 
     16   putStrLn "\nestimate:"
     17   print (mc samples)
     18