-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaces #1437 - additional documentation for filldist and arraydist #1751
Conversation
Could this PR get a more informative description? |
k = length(unique(g)) | ||
a ~ filldist(Exponential(), k) # = Product(fill(Exponential(), k)) | ||
mu = a[g] | ||
x .~ Normal.(mu) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't an MvNormal
be more performant here?
Codecov Report
@@ Coverage Diff @@
## master #1751 +/- ##
===========================================
+ Coverage 65.56% 81.16% +15.60%
===========================================
Files 25 24 -1
Lines 1661 1476 -185
===========================================
+ Hits 1089 1198 +109
+ Misses 572 278 -294
Continue to review full report at Codecov.
|
Pull Request Test Coverage Report for Build 1587251083
💛 - Coveralls |
Co-authored-by: Rik Huijzer <[email protected]>
@@ -545,6 +545,41 @@ The `Gibbs` sampler can be used to specify unique automatic differentation backe | |||
|
|||
For more details of compositional sampling in Turing.jl, please check the corresponding [paper](http://proceedings.mlr.press/v84/ge18b.html). | |||
|
|||
### Working with filldist and arraydist | |||
|
|||
Turing provides `filldist(dist::Distribution, n::Int)` and `arraydist(dists::AbstractVector{<:Distribution})` as a simplified interface to construct product distributions, e.g., to model a set of variables that share the same structure but vary by group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a heads up, rather sooner than later they will be integrated and generalized in Distributions: JuliaStats/Distributions.jl#1391 I am working on a PR to DistributionsAD that would fix the errors mentioned in the last comments; then we can switch product_distribution
completely from Product
to ProductDistribution
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely improvements - I look forward to the new Distributions release!
many thanks, @trappmartin! |
This PR is aimed to replace #1437.