BetaBernoulliImportance.hs (386B)
1 2 module Main where 3 4 import Control.Monad 5 import Deanie 6 import Model.BetaBernoulli as Model 7 8 posterior :: Double -> Double -> Program (Double, Double) 9 posterior a b = 10 importance Model.observations (beta a b) logDensityBernoulli 11 12 main :: IO () 13 main = do 14 samples <- replicateM 1000 (sample (rvar (posterior 1 1))) 15 mapM_ print samples 16 17 putStrLn "\nestimate:" 18 print (mcw samples) 19