aboutsummaryrefslogtreecommitdiff
path: root/src/PPL/Sampling.hs
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2023-01-20 09:17:05 +1100
committerJustin Bedo <cu@cua0.org>2023-01-23 12:44:44 +1100
commit190a4dc5f5398e6646823aa41637f54cc8cb54aa (patch)
tree361e9503d5c0b5c8d84269821d1d1f0a6cc11913 /src/PPL/Sampling.hs
parent0718de4acc18df39152fc55d6bd279af56d7e2af (diff)
add symmetry
Diffstat (limited to 'src/PPL/Sampling.hs')
-rw-r--r--src/PPL/Sampling.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/PPL/Sampling.hs b/src/PPL/Sampling.hs
index 1d20838..b3b8a90 100644
--- a/src/PPL/Sampling.hs
+++ b/src/PPL/Sampling.hs
@@ -25,8 +25,8 @@ importance n m = do
cumsum = tail . scanl (+) 0
accumulate = uncurry zip . second cumsum . unzip
-mh :: MonadIO m => Double -> Meas a -> m [(a, Log Double)]
-mh p m = do
+mh :: MonadIO m => Double -> Double -> Meas a -> m [(a, Log Double)]
+mh p q m = do
newStdGen
g <- getStdGen
let (g1, g2) = split g
@@ -37,7 +37,7 @@ mh p m = do
step (t, x, w) = do
g <- get
let (g1, g2) = split g
- t' = mutateTree p g1 t
+ t' = mutateTree p q g1 t
(x', w') = head $ samples m t'
ratio = w' / w
(Exp . log -> r, g3) = random g2