TuringLang / Turing.jl

Bayesian inference with probabilistic programming.
https://turinglang.org
MIT License
2.04k stars 219 forks source link

filldist/arraydist construct NIW prior? #2391

Open Li-shiyue opened 1 week ago

Li-shiyue commented 1 week ago

Minimal working example

niw = NormalInverseWishart(mu0, kappa, cholesky(Lambda), nu)
# Σ ~ filldist(InverseWishart(niw.nu, niw.Lamchol),K)
Σ ~ arraydist([InverseWishart(niw.nu, niw.Lamchol) for i =1:K])
μ ~ arraydist([MvNormal(niw.mu, Σ[i]./niw.kappa) for i = 1:K])

Description

Can Turing support indexing from pre built arraydists or filldist,I failed to try ERROR: MethodError: no method matching reconstruct(::Tuple{Int64, Int64, Int64}, ::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true})

Julia version info

versioninfo() ``` (Paste here) ```

Manifest

]st --manifest ``` (Paste here) ```
torfjelde commented 1 week ago

Can Turing support indexing from pre built arraydists or filldist?

Yep!

In the above, you're not re-using niw distribution, so that's not what's happening here:)

But can you add the ]st --manifest to your issue? This works on my end so you might just be on an old version.