Skip to content

Commit 3e66970

Browse files
committed
Remove PG tests with dynamic number of Gibbs-conditioned-observations
1 parent 6ca896b commit 3e66970

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

test/mcmc/gibbs.jl

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ end
207207
val ~ Normal(s, 1)
208208
1.0 ~ Normal(s + m, 1)
209209

210-
n := m + 1
211-
xs = M(undef, n)
210+
n := m
211+
xs = M(undef, 5)
212212
for i in eachindex(xs)
213213
xs[i] ~ Beta(0.5, 0.5)
214214
end
@@ -565,42 +565,6 @@ end
565565
end
566566
end
567567

568-
# The below test used to sample incorrectly before
569-
# https://github.com/TuringLang/Turing.jl/pull/2328
570-
@testset "dynamic model with ESS" begin
571-
@model function dynamic_model_for_ess()
572-
b ~ Bernoulli()
573-
x_length = b ? 1 : 2
574-
x = Vector{Float64}(undef, x_length)
575-
for i in 1:x_length
576-
x[i] ~ Normal(i, 1.0)
577-
end
578-
end
579-
580-
m = dynamic_model_for_ess()
581-
chain = sample(m, Gibbs(:b => PG(10), :x => ESS()), 2000; discard_initial=100)
582-
means = Dict(:b => 0.5, "x[1]" => 1.0, "x[2]" => 2.0)
583-
stds = Dict(:b => 0.5, "x[1]" => 1.0, "x[2]" => 1.0)
584-
for vn in keys(means)
585-
@test isapprox(mean(skipmissing(chain[:, vn, 1])), means[vn]; atol=0.1)
586-
@test isapprox(std(skipmissing(chain[:, vn, 1])), stds[vn]; atol=0.1)
587-
end
588-
end
589-
590-
@testset "dynamic model with dot tilde" begin
591-
@model function dynamic_model_with_dot_tilde(
592-
num_zs=10, (::Type{M})=Vector{Float64}
593-
) where {M}
594-
z = Vector{Int}(undef, num_zs)
595-
z .~ Poisson(1.0)
596-
num_ms = sum(z)
597-
m = M(undef, num_ms)
598-
return m .~ Normal(1.0, 1.0)
599-
end
600-
model = dynamic_model_with_dot_tilde()
601-
sample(model, Gibbs(:z => PG(10), :m => HMC(0.01, 4)), 100)
602-
end
603-
604568
@testset "Demo model" begin
605569
@testset verbose = true "$(model.f)" for model in DynamicPPL.TestUtils.DEMO_MODELS
606570
vns = DynamicPPL.TestUtils.varnames(model)

0 commit comments

Comments
 (0)