Skip to content

Commit b8302f7

Browse files
author
Hong Ge
committed
Merge branch 'master' into unify-step
# Conflicts: # src/samplers/gibbs.jl
2 parents 5083ae4 + cdeeddc commit b8302f7

File tree

5 files changed

+118
-254
lines changed

5 files changed

+118
-254
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ c4 = sample(gdemo([1.5, 2]), Gibbs(1000, PG(10, 2, :m), HMC(2, 0.1, 5, :s)))
8181
describe(c3)
8282

8383
# Plot results
84-
p = plot(c3)
85-
draw(p, "gdemo-plot.svg")
84+
p = Turing.plot(c3)
85+
Turing.draw(p, fmt=:pdf, filename="gdemo-plot.pdf")
8686
```
8787

8888
The arguments for each sampler are

benchmarks/gauss-stan.run.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ using Turing
33
using Stan
44

55
include(Pkg.dir("Turing")*"/benchmarks/benchmarkhelper.jl")
6-
include(Pkg.dir("Turing")*"/example-models/stan-models/simplegauss-stan.data.jl")
7-
include(Pkg.dir("Turing")*"/example-models/stan-models/simplegauss-stan.model.jl")
6+
include(Pkg.dir("Turing")*"/example-models/benchmarks/gdemo-stan.data.jl")
7+
include(Pkg.dir("Turing")*"/example-models/benchmarks/gdemo-stan.model.jl")
88

99
stan_model_name = "simplegauss"
1010
simplegaussstan = Stanmodel(name=stan_model_name, model=simplegaussstanmodel, nchains=1);

benchmarks/gauss.run.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ using Turing
33
using Stan
44

55
include(Pkg.dir("Turing")*"/benchmarks/benchmarkhelper.jl")
6-
include(Pkg.dir("Turing")*"/example-models/stan-models/simplegauss.data.jl")
7-
include(Pkg.dir("Turing")*"/example-models/stan-models/simplegauss.model.jl")
6+
include(Pkg.dir("Turing")*"/example-models/benchmarks/gdemo.data.jl")
7+
include(Pkg.dir("Turing")*"/example-models/benchmarks/gdemo.model.jl")
88

99
bench_res = tbenchmark("HMC(2000, 0.1, 3)", "simplegaussmodel", "simplegaussdata")
1010
logd = build_logd("Simple Gaussian Model", bench_res...)
1111
logd["analytic"] = Dict("s" => 49/24, "m" => 7/6)
1212

13-
include(Pkg.dir("Turing")*"/benchmarks/"*"simplegauss-stan.run.jl")
13+
include(Pkg.dir("Turing")*"/benchmarks/"*"gauss-stan.run.jl")
1414

1515
logd["stan"] = Dict("s" => mean(s_stan), "m" => mean(m_stan))
1616
logd["time_stan"] = sg_time

example-models/notebooks/BayesHmm.ipynb

Lines changed: 108 additions & 245 deletions
Large diffs are not rendered by default.

src/samplers/gibbs.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function sample(model::Function, alg::Gibbs)
7070
dprintln(2, "Gibbs stepping...")
7171

7272
for local_spl in spl.info[:samplers]
73-
local_spl.info[:progress] = spl.info[:progress]
73+
if haskey(spl.info, :progress) local_spl.info[:progress] = spl.info[:progress] end
7474

7575
dprintln(2, "$(typeof(local_spl)) stepping...")
7676

@@ -100,7 +100,8 @@ function sample(model::Function, alg::Gibbs)
100100

101101
if spl.alg.thin samples[i].value = Sample(varInfo).value end
102102

103-
ProgressMeter.next!(spl.info[:progress])
103+
haskey(spl.info, :progress) &&
104+
ProgressMeter.update!(spl.info[:progress], spl.info[:progress].counter+1)
104105
end
105106

106107
Chain(0, samples) # wrap the result by Chain

0 commit comments

Comments
 (0)