From 190a4dc5f5398e6646823aa41637f54cc8cb54aa Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 20 Jan 2023 09:17:05 +1100 Subject: add symmetry --- src/PPL/Sampling.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/PPL/Sampling.hs') 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 -- cgit v1.2.3