-
Notifications
You must be signed in to change notification settings - Fork 30
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
Added extension for MCMCChains #514
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
We could also support Julia 1.6 via Requires. It will also fix failing CIs for Julia 1.6. |
Alternatively, we could make MCMCChains a regular dependency on Julia < 1.9. |
Is this trivial to do? Not completely obvious to me how the |
…orfjelde/mcmcchains-ext
But I'll make this "merge when ready", and then we can discuss how to deal with < 1.9 |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #514 +/- ##
==========================================
+ Coverage 76.22% 76.35% +0.13%
==========================================
Files 23 24 +1
Lines 2763 2770 +7
==========================================
+ Hits 2106 2115 +9
+ Misses 657 655 -2
☔ View full report in Codecov by Sentry. |
You just add it also to the |
But doesn't this also make it a dep rather than a weakdep on Julia 1.9? |
No. |
Ah, I had completely missed this part of the docs; https://pkgdocs.julialang.org/dev/creating-packages/#Transition-from-normal-dependency-to-extension |
Btw, what's up with the CI now? Didn't we fix this issue of being able to auto-merge at some point? o.O |
Oh, it seems that removing and re-adding to the merge queue finally triggered the integration tests 👍 |
There is some functionality in DPPL that dispatches on
chain::AbstractChains
while we are in fact assuming the behavior ofchain::MCMCChains.Chains
.This PR adds an extension for MCMCChains.jl so that we can specialize further when it makes sense.
In particular, in the case of
generated_quantities(model, chain)
we warn the user if some variables are present inchain
but not inmodel
. This makes sense if all the variables present inchain
are parameters, but less so when we are also working with internal parameters; in such a scenario, the user end up seeing tons of warnings regarding unused variables (which are in fact internal variables of the sampler). In this scenario, it makes sense to specialize further onMCMCChains.Chains
and callget_sections(chain, :parameters)
before callingsetval_and_resample!
; this we can now do in the extension.Note that this I'm not adding Requires.jl or a new dependency in this PR; the change mentioned above is just something that users on Julia 1.9 gets for free without any cost to the ones on Julia 1.8. We can discuss whether we should also add Requires.jl, etc. but I think for now this is an okay thing to do 🤷
EDIT: Other methods that should eventually be moved is
Turing.predict
: https://github.com/TuringLang/Turing.jl/blob/78b543847a4e8791ea06569de47a92c2b9a43151/src/inference/Inference.jl#L564-L596