Skip to content

Commit 83a6969

Browse files
committed
replace more filldist with product_distribution
1 parent dd86d61 commit 83a6969

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

models/dppl_hier_poisson.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using LazyArrays
21
using Turing: LogPoisson
32

43
nd, ns = 5, 10
@@ -19,9 +18,9 @@ lazyarray(f, x) = LazyArray(Base.broadcasted(f, x))
1918
a0 ~ Normal(0, 10)
2019
a1 ~ Normal(0, 1)
2120
a0_sig ~ truncated(Cauchy(0, 1); lower=0)
22-
a0s ~ filldist(Normal(0, a0_sig), ns)
21+
a0s ~ product_distribution(fill(Normal(0, a0_sig), ns))
2322
alpha = a0 .+ a0s[idx] .+ a1 * x
24-
y ~ arraydist(lazyarray(LogPoisson, alpha))
23+
y ~ product_distribution(LogPoisson.(alpha))
2524
end
2625

2726
model = dppl_hier_poisson(y, x, idx, ns)

models/dppl_high_dim_gauss.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@model function dppl_high_dim_gauss(D)
2-
m ~ filldist(Normal(0, 1), D)
2+
m ~ product_distribution(fill(Normal(0, 1), D))
33
end
44

55
model = dppl_high_dim_gauss(10_000)

models/dppl_lda.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ for i in 1:m
2121
end
2222

2323
@model function dppl_lda(k, m, w, doc, alpha, beta)
24-
theta ~ filldist(Dirichlet(alpha), m)
25-
phi ~ filldist(Dirichlet(beta), k)
24+
theta ~ product_distribution(fill(Dirichlet(alpha), m))
25+
phi ~ product_distribution(fill(Dirichlet(beta), k))
2626
log_phi_dot_theta = log.(phi * theta)
2727
@addlogprob! sum(log_phi_dot_theta[CartesianIndex.(w, doc)])
2828
end

models/dppl_naive_bayes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ image_vec = vec(image_subset[:, :])
2020
labels = labels[1:N]
2121

2222
@model function dppl_naive_bayes(image_vec, labels, C, D)
23-
m ~ filldist(Normal(0, 10), C, D)
23+
m ~ product_distribution(fill(Normal(0, 10), C, D))
2424
image_vec ~ MvNormal(vec(m[labels, :]), I)
2525
end
2626

0 commit comments

Comments
 (0)