tests/prob_prog/mcmc/propose/Model.hs
raw| 1 | module Model where |
| 2 | |
| 3 | import Probability |
| 4 | import MCMC |
| 5 | |
| 6 | model = do |
| 7 | |
| 8 | -- Default moves have a rate of 0. |
| 9 | x <- RanSamplingRate 0 $ sample $ normal 0 1 |
| 10 | |
| 11 | -- Force x ... so that the transition kernels happen? |
| 12 | condition (x > 0 || x <= 0) |
| 13 | |
| 14 | -- Try out the generic proposal for atomic objects. |
| 15 | addMove 10 $ metropolisHastings $ propose x (\x -> normal (x+1) 1) |
| 16 | |
| 17 | -- Log x |
| 18 | return ["x" %=% x] |
| 19 | |
| 20 | main dir = return model |