Skip to content

Commit

Permalink
fix test for particle gibbs
Browse files Browse the repository at this point in the history
  • Loading branch information
emilemathieu committed Nov 19, 2017
1 parent bfe109c commit 1bd3902
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/gibbs.jl/gibbs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ using Distributions
using Turing
using Base.Test

srand(125)

x = [1.5 2.0]

@model gibbstest(x) = begin
Expand All @@ -13,12 +15,12 @@ x = [1.5 2.0]
s, m
end

check_numerical(
sample(gibbstest(x), Gibbs(1500, PG(30, 3, :s), HMC(1, 0.2, 4, :m))),
[:s, :m], [49/24, 7/6]
)
alg = Gibbs(1000, CSMC(30, 3, :s), HMC(3, 0.2, 4, :m))
chain = sample(gibbstest(x), alg)
@test mean(chain[:s]) 49/24 atol=0.1
@test mean(chain[:m]) 7/6 atol=0.1

check_numerical(
sample(gibbstest(x), PG(30, 2500)),
[:s, :m], [49/24, 7/6]
)
alg = CSMC(30, 2500)
chain = sample(gibbstest(x), alg)
@test mean(chain[:s]) 49/24 atol=0.1
@test mean(chain[:m]) 7/6 atol=0.1

0 comments on commit 1bd3902

Please sign in to comment.