Skip to content

Commit

Permalink
CompatHelper: bump compat for "AdvancedPS" to "0.2" (#1610)
Browse files Browse the repository at this point in the history
* CompatHelper: bump compat for "AdvancedPS" to "0.2"

* CompatHelper: bump compat for "AdvancedPS" to "0.2" for package test (#1612)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Add missing argument

* Not compatible with 0.1 anymore

* Fix `randcat`

* Not compatible with 0.1 anymore

* Fix resample

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: David Widmann <[email protected]>
  • Loading branch information
github-actions[bot] and devmotion authored May 15, 2021
1 parent 7131eb8 commit 38cba6a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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"
Expand Down
22 changes: 11 additions & 11 deletions src/inference/AdvancedSMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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)
Expand Down Expand Up @@ -100,7 +100,7 @@ function AbstractMCMC.sample(
end

function DynamicPPL.initialstep(
::AbstractRNG,
rng::AbstractRNG,
model::AbstractModel,
spl::Sampler{<:SMC},
vi::AbstractVarInfo;
Expand All @@ -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]
Expand Down Expand Up @@ -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`.
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -273,7 +273,7 @@ function DynamicPPL.initialstep(
end

function AbstractMCMC.step(
::AbstractRNG,
rng::AbstractRNG,
model::AbstractModel,
spl::Sampler{<:PG},
vi::AbstractVarInfo;
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

2 comments on commit 38cba6a

@devmotion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/36772

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.15.23 -m "<description of version>" 38cba6ac2e6aa912b9907b263d6048cb8d3613c6
git push origin v0.15.23

Please sign in to comment.