diff --git a/benchmark/SSM.hs b/benchmark/SSM.hs index c57c8dcb..ec873a0a 100644 --- a/benchmark/SSM.hs +++ b/benchmark/SSM.hs @@ -7,7 +7,7 @@ import Control.Monad.Bayes.Inference.RMSMC (rmsmcDynamic) import Control.Monad.Bayes.Inference.SMC import Control.Monad.Bayes.Inference.SMC2 as SMC2 (smc2) import Control.Monad.Bayes.Population -import Control.Monad.Bayes.Population (population, resampleMultinomial) +import Control.Monad.Bayes.Population (resampleMultinomial, runPopulationT) import Control.Monad.Bayes.Sampler.Strict (sampleIO, sampleIOfixed, sampleWith) import Control.Monad.Bayes.Weighted (unweighted) import Control.Monad.IO.Class (MonadIO (liftIO)) diff --git a/benchmark/Speed.hs b/benchmark/Speed.hs index c9b6f7b2..0d72808c 100644 --- a/benchmark/Speed.hs +++ b/benchmark/Speed.hs @@ -8,7 +8,7 @@ import Control.Monad.Bayes.Class (MonadMeasure) import Control.Monad.Bayes.Inference.MCMC (MCMCConfig (MCMCConfig, numBurnIn, numMCMCSteps, proposal), Proposal (SingleSiteMH)) import Control.Monad.Bayes.Inference.RMSMC (rmsmcDynamic) import Control.Monad.Bayes.Inference.SMC (SMCConfig (SMCConfig, numParticles, numSteps, resampler), smc) -import Control.Monad.Bayes.Population (population, resampleSystematic) +import Control.Monad.Bayes.Population (resampleSystematic, runPopulationT) import Control.Monad.Bayes.Sampler.Strict (SamplerIO, sampleIOfixed) import Control.Monad.Bayes.Traced (mh) import Control.Monad.Bayes.Weighted (unweighted) @@ -59,10 +59,10 @@ instance Show Alg where runAlg :: Model -> Alg -> SamplerIO String runAlg model (MH n) = show <$> unweighted (mh n (buildModel model)) -runAlg model (SMC n) = show <$> population (smc SMCConfig {numSteps = (modelLength model), numParticles = n, resampler = resampleSystematic} (buildModel model)) +runAlg model (SMC n) = show <$> runPopulationT (smc SMCConfig {numSteps = (modelLength model), numParticles = n, resampler = resampleSystematic} (buildModel model)) runAlg model (RMSMC n t) = show - <$> population + <$> runPopulationT ( rmsmcDynamic MCMCConfig {numMCMCSteps = t, numBurnIn = 0, proposal = SingleSiteMH} SMCConfig {numSteps = modelLength model, numParticles = n, resampler = resampleSystematic} diff --git a/docs/docs/notebooks/Diagrams.html b/docs/docs/notebooks/Diagrams.html index bbc54d16..49779584 100644 --- a/docs/docs/notebooks/Diagrams.html +++ b/docs/docs/notebooks/Diagrams.html @@ -14729,8 +14729,8 @@

Viewing tracesIn [3]:
-
getTrace :: Weighted (Density SamplerIO) a -> SamplerIO ([Double], Log Double)
-getTrace m = fmap (\((x,y),z) -> (z,y) ) $ runWriterT $ weighted $ Weighted.hoist (WriterT . density []) m
+
getTrace :: WeightedT (DensityT SamplerIO) a -> SamplerIO ([Double], Log Double)
+getTrace m = fmap (\((x,y),z) -> (z,y) ) $ runWriterT $ runWeightedT $ Weighted.hoist (WriterT . runDensityT []) m
 
diff --git a/docs/docs/notebooks/Histogram.html b/docs/docs/notebooks/Histogram.html index 68e02ab6..5130cfb0 100644 --- a/docs/docs/notebooks/Histogram.html +++ b/docs/docs/notebooks/Histogram.html @@ -14642,7 +14642,7 @@

Distributions over anything return y distributionOverWeightedSamples :: Distribution (Double, Log Double) -distributionOverWeightedSamples = weighted unnormalizedDistribution +distributionOverWeightedSamples = runWeightedT unnormalizedDistribution iidDistribution :: Distribution [(Double, Log Double)] iidDistribution = replicateM 100000 distributionOverWeightedSamples diff --git a/docs/docs/notebooks/Parsing.html b/docs/docs/notebooks/Parsing.html index 610b39ff..ccf7659d 100644 --- a/docs/docs/notebooks/Parsing.html +++ b/docs/docs/notebooks/Parsing.html @@ -14701,7 +14701,7 @@

Probabilistic Parser CombinatorsrunWordParser w = do x <- sampler - . population + . runPopulationT . smc SMCConfig {numSteps = 5, numParticles = 3000, resampler = resampleMultinomial} $ run word w pPrintCustom $ toEmpiricalWeighted x diff --git a/docs/docs/notebooks/Streaming.html b/docs/docs/notebooks/Streaming.html index 6925c50f..e00cc669 100644 --- a/docs/docs/notebooks/Streaming.html +++ b/docs/docs/notebooks/Streaming.html @@ -14906,7 +14906,7 @@

Conditioning&#