diff --git a/Project.toml b/Project.toml index 6f41ce2e5..3035b0652 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Turing" uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0" -version = "0.15.22" +version = "0.15.23" [deps] AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001" @@ -36,7 +36,7 @@ ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444" AbstractMCMC = "3.2" AdvancedHMC = "0.2.24" AdvancedMH = "0.6" -AdvancedPS = "0.1" +AdvancedPS = "0.2" AdvancedVI = "0.1" BangBang = "0.3" Bijectors = "0.8, 0.9" diff --git a/src/inference/AdvancedSMC.jl b/src/inference/AdvancedSMC.jl index 7a4f69b90..2b60e772c 100644 --- a/src/inference/AdvancedSMC.jl +++ b/src/inference/AdvancedSMC.jl @@ -22,7 +22,7 @@ end """ SMC(space...) SMC([resampler = AdvancedPS.ResampleWithESSThreshold(), space = ()]) - SMC([resampler = AdvancedPS.resample, ]threshold[, space = ()]) + SMC([resampler = AdvancedPS.resample_systematic, ]threshold[, space = ()]) Create a sequential Monte Carlo sampler of type [`SMC`](@ref) for the variables in `space`. @@ -37,7 +37,7 @@ end function SMC(resampler, threshold::Real, space::Tuple = ()) return SMC(AdvancedPS.ResampleWithESSThreshold(resampler, threshold), space) end -SMC(threshold::Real, space::Tuple = ()) = SMC(AdvancedPS.resample, threshold, space) +SMC(threshold::Real, space::Tuple = ()) = SMC(AdvancedPS.resample_systematic, threshold, space) # If only the space is defined SMC(space::Symbol...) = SMC(space) @@ -100,7 +100,7 @@ function AbstractMCMC.sample( end function DynamicPPL.initialstep( - ::AbstractRNG, + rng::AbstractRNG, model::AbstractModel, spl::Sampler{<:SMC}, vi::AbstractVarInfo; @@ -119,7 +119,7 @@ function DynamicPPL.initialstep( ) # Perform particle sweep. - logevidence = AdvancedPS.sweep!(particles, spl.alg.resampler) + logevidence = AdvancedPS.sweep!(rng, particles, spl.alg.resampler) # Extract the first particle and its weight. particle = particles.vals[1] @@ -180,7 +180,7 @@ end """ PG(n, space...) PG(n, [resampler = AdvancedPS.ResampleWithESSThreshold(), space = ()]) - PG(n, [resampler = AdvancedPS.resample, ]threshold[, space = ()]) + PG(n, [resampler = AdvancedPS.resample_systematic, ]threshold[, space = ()]) Create a Particle Gibbs sampler of type [`PG`](@ref) with `n` particles for the variables in `space`. @@ -201,7 +201,7 @@ function PG(nparticles::Int, resampler, threshold::Real, space::Tuple = ()) return PG(nparticles, AdvancedPS.ResampleWithESSThreshold(resampler, threshold), space) end function PG(nparticles::Int, threshold::Real, space::Tuple = ()) - return PG(nparticles, AdvancedPS.resample, threshold, space) + return PG(nparticles, AdvancedPS.resample_systematic, threshold, space) end # If only the number of particles and the space is defined @@ -258,11 +258,11 @@ function DynamicPPL.initialstep( ) # Perform a particle sweep. - logevidence = AdvancedPS.sweep!(particles, spl.alg.resampler) + logevidence = AdvancedPS.sweep!(rng, particles, spl.alg.resampler) # Pick a particle to be retained. Ws = AdvancedPS.getweights(particles) - indx = AdvancedPS.randcat(Ws) + indx = AdvancedPS.randcat(rng, Ws) reference = particles.vals[indx] # Compute the first transition. @@ -273,7 +273,7 @@ function DynamicPPL.initialstep( end function AbstractMCMC.step( - ::AbstractRNG, + rng::AbstractRNG, model::AbstractModel, spl::Sampler{<:PG}, vi::AbstractVarInfo; @@ -301,11 +301,11 @@ function AbstractMCMC.step( particles = AdvancedPS.ParticleContainer(x) # Perform a particle sweep. - logevidence = AdvancedPS.sweep!(particles, spl.alg.resampler) + logevidence = AdvancedPS.sweep!(rng, particles, spl.alg.resampler) # Pick a particle to be retained. Ws = AdvancedPS.getweights(particles) - indx = AdvancedPS.randcat(Ws) + indx = AdvancedPS.randcat(rng, Ws) newreference = particles.vals[indx] # Compute the transition. diff --git a/test/Project.toml b/test/Project.toml index a97c4d073..d759cbcd4 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -30,7 +30,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [compat] AbstractMCMC = "3.2" AdvancedMH = "0.6" -AdvancedPS = "0.1" +AdvancedPS = "0.2" AdvancedVI = "0.1" Clustering = "0.14" CmdStan = "6.0.8"