Skip to content
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

Merged
merged 3 commits into from
Dec 16, 2021

Conversation

trappmartin
Copy link
Member

This PR is aimed to replace #1437.

@rikhuijzer
Copy link
Contributor

Could this PR get a more informative description? Replaces #1437 doesn't provide much info to the reader of this PR title or to the reader of the Git history once this PR is merged.

k = length(unique(g))
a ~ filldist(Exponential(), k) # = Product(fill(Exponential(), k))
mu = a[g]
x .~ Normal.(mu)
Copy link
Contributor

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
Copy link

codecov bot commented Dec 16, 2021

Codecov Report

Merging #1751 (6638bf4) into master (6dca57e) will increase coverage by 15.60%.
The diff coverage is n/a.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
src/core/container.jl 76.19% <0.00%> (-14.41%) ⬇️
src/inference/emcee.jl 88.23% <0.00%> (-9.55%) ⬇️
src/inference/is.jl 93.75% <0.00%> (-6.25%) ⬇️
src/inference/hmc.jl 76.33% <0.00%> (-5.92%) ⬇️
src/core/ad.jl 81.01% <0.00%> (-3.71%) ⬇️
src/variational/VariationalInference.jl 53.84% <0.00%> (-3.30%) ⬇️
src/inference/Inference.jl 84.55% <0.00%> (-0.69%) ⬇️
src/Turing.jl 100.00% <0.00%> (ø)
src/core/Core.jl 100.00% <0.00%> (ø)
src/core/deprecations.jl
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6dca57e...6638bf4. Read the comment docs.

@coveralls
Copy link

coveralls commented Dec 16, 2021

Pull Request Test Coverage Report for Build 1587251083

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 81.165%

Totals Coverage Status
Change from base Build 1566645174: 0.0%
Covered Lines: 1198
Relevant Lines: 1476

💛 - Coveralls

@trappmartin trappmartin changed the title Replaces #1437 Replaces #1437 - additional documentation for filldist and arraydist Dec 16, 2021
@@ -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.
Copy link
Member

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.

Copy link
Member

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!

@yebai
Copy link
Member

yebai commented Dec 16, 2021

many thanks, @trappmartin!

@yebai yebai merged commit 84d395b into master Dec 16, 2021
@delete-merged-branch delete-merged-branch bot deleted the martint/filldist branch December 16, 2021 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants