-
Notifications
You must be signed in to change notification settings - Fork 228
Get MarginalLogDensities extension working with Turing v0.40 #2662
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
Get MarginalLogDensities extension working with Turing v0.40 #2662
Conversation
* Reduce iterations in ESS tests * Reduce iterations in HMC tests * Document an HMC test better * Reduce iterations in Inference.jl tests * Use StableRNG in Inferenc.jl tests * Increase some iteration counts * Increase some iter counts * Increase some iter counts * Fix use of rng in tests, and other seed stuff * Reduce an iter count in sghmc tests * Reduce sample counts in abstractmcmc tests * Improve an MH test * Improvements to MH tests * More test tweaks * Adjust HMC iteration counts * Adjust sample counts in ESS tests * Reduce ISS test sample count * Remove some long-dead tests * Increase an iter count * Mark some top-level testsets as verbose * Bump Mooncake compat to 0.4.61 * Simplify Wishart HMC test * Increase some sample counts * Use StableRNG(seed) rather than copy(rng) * Increase tolerance marginally on some tests --------- Co-authored-by: Penelope Yong <[email protected]>
Co-authored-by: Hong Ge <[email protected]>
* Add DynamicPPL integration tests * Bump DynamicPPL compat -> 0.32 * Remove / export deprecated functions as needed Including @SubModel, to_submodel, link!, invlink! * Update submodel names as per DPPL 0.32 * Enable concurrency on PR testing to avoid wastage * Bump Turing patch version * Improve descriptions of tests Co-authored-by: Hong Ge <[email protected]> * Update test/dynamicppl/compiler.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: Hong Ge <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Replace old Gibbs sampler with the experimental one. * Remove dead references to experimental * Remove mention of experimental from JuliaFormatter conf * Add tests for deprecated constructor * Fix deprecated Gibbs constructors. Add HISTORY entry. * Bump version to 0.35.0 * Add Gibbs constructor test for repeat samplers * Fix typo in test/mcmc/ess.jl * Use provided rng to initialise VarInfo in Gibbs * Fix a typo in GibbsContext * Fix the Gibbs sampler * Fix the Gibbs sampler more * Remove mentions of old Gibbs sampler from MH docs Co-authored-by: Penelope Yong <[email protected]> * Bump DPPL to 0.28.6 * Redesign GibbsContext, work in progress * Fixing new Gibbs, adding a broken test * Document and clean up GibbsContext * Code style and docs improvements to Gibbs * Change how AdvancedHMC Gibbs state treats momenta * Remove unnecessary invlinking * Change how AdvancedHMC Gibbs state treats momenta, again * Use setparams!! rather than reset_state!! * Don't overload setparams\!\! with VarInfo * A fix for ESS in Gibbs * Remove recompute_logprob!! * Fix setparams_varinfo!! for MH * Stop hard coding the leafcontext for MH setparams_varinfo!! * Fix setparams_varinfo!! for ESS * Fix the context used by setparams_varinfo!! ESS * Add GibbsContext type stability tests * Apply suggestions from code review Co-authored-by: Tor Erlend Fjelde <[email protected]> * Add clarifying comment * Add setparams_varinfo!! type bounds * Fix an import * Style improvement * Improve GibbsContext type stability test * Add comment to constructor tests * Fix a Gibbs test * Document the methods of `varinfo` better * Check whether a sampler is a valid Gibbs component * Move varinfo methods where they belong * Fix calling of child context in GibbsContext * Fix Selectors and type stability of Gibbs * Fix broken short circuit in MH * Stop unnecessary use of Val in GibbsContext * Enforce GibbsContext being next to a leaf * Fix setparams_varinfo!! for ESS * Fix a small Gibbs bug * Fix Gibbs sampler test * Add back tests that were accidentally commented out * Relax a test tolerance * Add a Gibbs test for dynamic model with ESS * Use ESS in Gibbs DEMO_MODELS tests * Add Gibbs component call order test * Fix Gibbs linking bug, add tests * Make Gibbs constructor more flexible * Introduce RepeatSampler * Switch gold standard sample Gibbs test back to HMC I tried using ESS instead, because I thought it would test behavior a bit more broadly, given similarities between HMC and NUTS. It worked locally, but the KS test fails in one or two cases on CI. * Clean up RepeatSamplerTests preamble * Fix RepeatSampler in Gibbs bug * Rename a function in Gibbs * Test HMCDA in Gibbs tests * Simplify is_target_varname * Add suggestions from code review Co-authored-by: Tor Erlend Fjelde <[email protected]> * Add a couple of issue references * Restructure Gibbs inference tests and reduce iteration counts * Reduce another iter count in Gibbs tests * Add an info print to Gibbs tests * Use StableRNG, relax test tolerance * Fix a kwarg --------- Co-authored-by: Penelope Yong <[email protected]> Co-authored-by: Tor Erlend Fjelde <[email protected]>
… package test, (keep existing compat) (TuringLang#2443) Co-authored-by: CompatHelper Julia <[email protected]>
…ckage test, (keep existing compat) (TuringLang#2444) Co-authored-by: CompatHelper Julia <[email protected]>
… package test, (keep existing compat) (TuringLang#2448) Co-authored-by: CompatHelper Julia <[email protected]>
…keep existing compat) (TuringLang#2447) Co-authored-by: CompatHelper Julia <[email protected]>
* Rework Gibbs constructors, and remove the dead test/experimental/gibbs.jl * Update HISTORY.md * Clarify docstring * Remove unnecessary _maybecollect in gibbs.jl * Fix a bug * Fix more Gibbs constructors in tests * Improve HISTORY.md note Co-authored-by: Penelope Yong <[email protected]> * Apply proposals from code review * Add type bounds to Gibbs type parameters * Style improvements to gibbs.jl * Fix method ambiguity * Modify type signature of Gibbs --------- Co-authored-by: Penelope Yong <[email protected]>
* Use recursion in gibbs_inner_step * Remove unnecessary initialisation in Gibbs We were doing work that was already done by the caller of initialstep. * variable naming / destructuring (TuringLang#2465) * Variable naming, destructuring * Tuple -> Vec * Reviewdog code style suggestions Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: Penelope Yong <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Update for DynamicPPL 0.33 * Don't remove import/export * 0.34 too * Update test compat too * Remove upstream tests for `predict`
…uringLang#2472) * Add a test that catches a bug in Gibbs * Bump patch version to 0.36.1 * Bump DPPL compat to 0.34.1 * Expand comment
* Using Turing actions for docs TuringLang/actions#12 * Update DocsNav.yml Using https://github.com/TuringLang/actions/tree/main/DocsNav reference: TuringLang/actions#12 * Update make.jl No need of deploydocs after using [Turing actions](https://github.com/TuringLang/actions/tree/main/DocsDocumenter) reference: TuringLang/actions#12 * Update Docs.yml * Update .github/workflows/Docs.yml Co-authored-by: Penelope Yong <[email protected]> * Update .github/workflows/DocsNav.yml Co-authored-by: Penelope Yong <[email protected]> --------- Co-authored-by: Penelope Yong <[email protected]>
* Return NaN for negative ModeResult variance estimates * Apply suggestions from mhauru Co-authored-by: Markus Hauru <[email protected]> * Add doc to StatsBase.coefTable(::ModeResult, ...) for numerrors_warnonly * Add test for same coeftable with/without numerrors_warnonly * Add a test for coeftable with negative variance --------- Co-authored-by: Markus Hauru <[email protected]> Co-authored-by: Xianda Sun <[email protected]> Co-authored-by: Markus Hauru <[email protected]>
…2489) * add prefix to predict * add `using DynamicPPL` * add DynamicPPL to doc dep
* Remove x86 CI * Reorder name of test
* Make Gibbs work with step_warmup * Bump patch version to 0.36.3 * Fix a Gibbs bug
…at) (TuringLang#2503) * CompatHelper: bump compat for AdvancedHMC to 0.7, (keep existing compat) * Relax two test tolerances a bit * Adjust some tolerances and sample counts in tests * Adjust more test sample counts --------- Co-authored-by: CompatHelper Julia <[email protected]> Co-authored-by: Markus Hauru <[email protected]>
* Bump minor version to v0.37 * Remove selector/space stuff (TuringLang#2458) * Remove selector stuff from ESS * Remove selector stuff from MH * Remove selector stuff from HMC * Remove selector stuff from Emcee * Remove selector stuff from IS * Add missing getspace methods * Remove selector stuff for particle methods * Fix an HMC selector bug * Code style * Fix Emcee selector bug * Fix typo in ESS tests * Fix some constructor overwrites * Remove unnecessary tests * Remove selector stuff from SGHMC * Remove drop_space and other non-longer-necessary deprecation measures * Bump minor version 0.37. Add a HISTORY.md entry * Apply suggestions from code review Co-authored-by: Penelope Yong <[email protected]> * Remove unnecessary type parameters Co-authored-by: Penelope Yong <[email protected]> * Simplify constructors in particle_mcmc.jl * Remove calls to setgid and updategid --------- Co-authored-by: Penelope Yong <[email protected]> * Bump Mooncake compat to 0.4.95 * Support for DynamicPPL v0.35 (TuringLang#2488) * Progress towards compat with DPPL v0.35 * More fixing of DPPL v0.35 stuff * Fix LogDensityFunction argument order * More minor bugfixes * [TEMP] Commit Manifest pointing to DynamicPPL#release-0.35 * remove LogDensityProblemsAD (TuringLang#2490) * Remove LogDensityProblemsAD, part 1 * update Optimisation code to not use LogDensityProblemsAD * Fix field name change * Don't put chunksize=0 * Remove LogDensityProblemsAD dep * Improve OptimLogDensity docstring * Remove unneeded model argument to _optimize * Fix more tests * Remove essential/ad from the list of CI groups * Fix HMC function * more test fixes (TuringLang#2491) * Remove LogDensityProblemsAD, part 1 * update Optimisation code to not use LogDensityProblemsAD * Fix field name change * Don't put chunksize=0 * Remove LogDensityProblemsAD dep * Improve OptimLogDensity docstring * Remove unneeded model argument to _optimize * Fix more tests * Remove essential/ad from the list of CI groups * Fix HMC function * More test fixes * Remove Manifest * More fixes for DynamicPPL 0.35 (TuringLang#2494) * Remove test/dynamicppl/compiler.jl * Remove old regression tests * Remove vdemo2 * Fix last test * Add HISTORY.md entry about DPPL 0.35 * Allow ESS to sample variables with different symbols * Update a TODO note --------- Co-authored-by: Penelope Yong <[email protected]> * Fix call to DynamicPPL.initialize_parameters!! * Remove `Zygote` (TuringLang#2505) * Remove `Zygote`; fix TuringLang#2504 * Update test/test_utils/ad_utils.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Add HISTORY.md entry about removing support for Zygote --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Markus Hauru <[email protected]> Co-authored-by: Penelope Yong <[email protected]> Co-authored-by: Markus Hauru <[email protected]> * Fix a Gibbs test * Clean up exports (TuringLang#2474) * Regroup exports by package * Export DynamicPPL.returned and DynamicPPL.prefix * Stop exporting @logprob_str and @prob_str * Remove DynamicPPL module export * Remove DynamicPPL.LogDensityFunction re-export * Remove BernoulliLogit, drop support for Distributions < 0.25.77 * Stop blanket re-exporting Libtask and Bijectors * Manually specify AbstractMCMC exports * Format Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Remove Bijectors.ordered export * Re-export LinearAlgebra.I * Replace Turing.Model -> DynamicPPL.Model * Format * Keep exporting LogDensityFunction * Add note in docs * Align Turing exports with docs API page * Fix things like `predict` on docs API page * Fix a Gibbs test * Format * Fix missing Bijectors import * Update docs/src/api.md Co-authored-by: Markus Hauru <[email protected]> * Update docs/src/api.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Clean up broken docs links, remove unneeded deps * Format * Add changelog entry for exports * Clean up exports in essential/Essential * Apply suggestions from code review Co-authored-by: Markus Hauru <[email protected]> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Markus Hauru <[email protected]> Co-authored-by: Markus Hauru <[email protected]> --------- Co-authored-by: Penelope Yong <[email protected]> Co-authored-by: Hong Ge <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
To enable the Documenter.jl preview comment URL in PRs, write permissions are required for the `pull_request` event in GHA. This change grants the necessary permissions. See related PR for the comment feature: TuringLang/actions#19.
* DynamicPPL 0.36 * Fix prefixing test and docs * Fix deprecation warning for VarName(::Symbol) * Allow GibbsContext to wrap PrefixContext (but only PrefixContext) * Bump minor version instead * Enable non-identity VarNames in Gibbs Closes TuringLang#2403 * Add Gibbs tests for non-identity VarNames and submodels * Update src/mcmc/gibbs.jl Co-authored-by: Markus Hauru <[email protected]> * Add changelog note about Gibbs * Add more non-identity varname tests --------- Co-authored-by: Markus Hauru <[email protected]>
* Set minimum of OrderedLogistic distribution to 1 The minimum of the OrderedLogistic function is supposed to be 1, not 0. This is consistent with the documentation, and the behavior of the distribution when using rand(). * Add test for support of OrderedLogistic We add the test that the support should have the right number of elements, and that the probabilities add up to 1.0. * Format * Bump patch for release --------- Co-authored-by: Penelope Yong <[email protected]>
…g#2579) * Refactor dynamic model test to include analytical posterior and enhance sampling validation * Appeasing the formatter gods * formatting * Rollback Project.toml to previous commit * used existing function * Update test/mcmc/gibbs.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: AoifeHughes <[email protected]> Co-authored-by: Hong Ge <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* [no ci] Rework README * Re-add badges * [no ci] fix badges * [no ci] have more strongly worded discouragement for discussions * [no ci] add papers and bibtex * [no ci] add section on what's changed recently * Add getting started section * Implement review suggestions * Add Google Scholar cited-by link
…uringLang#2608) * Replace 2018 AISTATS conference paper with the latest 2025 journal publication * add back old citation * unify with turing.jl readme --------- Co-authored-by: Penelope Yong <[email protected]>
* Update logp in varinfo when external samplers are used * Add tests * More tests * Bump patch, changelog * Only do one extra model evaluation instead of two * Don't run the same test 13 times * Fix tests * Simplify interface * isapprox for floats... * Update comment / changelog
* AdvancedPS v0.7 support, work in progress * Fixing particle_mcmc.jl * Remove use of AdvancedPS.addreference! * Improve a comment * Update Project.toml (TuringLang#2598) * Fix a bug and a test * Bump Libtask to 0.9.3 Co-authored-by: Hong Ge <[email protected]> * Fix seed setting, increase iterations * Increate a test iteration count --------- Co-authored-by: Hong Ge <[email protected]> Co-authored-by: Penelope Yong <[email protected]>
* Add changelog * Bump patch too
* Fix missing closing parenthesis in README.md 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Update README.md Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Copilot <[email protected]>
* Avoid splitting up varnames until absolutely necessary * Fix more optimisation bits
* Fix externalsampler interface * Fix getparams docstring * Improve getparams docstrings * Fix tests
…compat) (TuringLang#2643) * CompatHelper: bump compat for DataStructures to 0.19, (keep existing compat) * Changelog --------- Co-authored-by: CompatHelper Julia <[email protected]> Co-authored-by: Penelope Yong <[email protected]>
Co-authored-by: AoifeHughes <[email protected]>
* [no ci] Bump to v0.40.0 * Uncomment tests that should be there * Support DPPL 0.37 (TuringLang#2550) * First efforts towards DPPL 0.37 compat, WIP * More DPPL 0.37 compat work, WIP * Add [sources] for [email protected] * Remove context argument from `LogDensityFunction` * Fix MH * Remove spurious logging * Remove residual OptimizationContext * Delete files that were removed in previous releases * Fix typo * Simplify ESS * Fix LDF * Fix Prior(), fix a couple more imports * fixes * actually fix prior * Remove extra return value from tilde_assume * fix ldf * actually fix prior * fix HMC log-density * fix ldf * fix make_evaluate_... * more fixes for evaluate!! * fix hmc * fix run_ad * even more fixes (oh goodness when will this end) * more fixes * fix * more fix fix fix * fix return values of tilde pipeline * even more fixes * Fix missing import * More MH fixes * Fix conversion * don't think it really needs those type params * implement copy for LogPriorWithoutJacAcc * Even more fixes * More fixes; I think the remaining failures are pMCMC related * Fix merge * DPPL 0.37 compat for particle MCMC (TuringLang#2625) * Progress in DPPL 0.37 compat for particle MCMC * WIP PMCMC work * Gibbs fixes for DPPL 0.37 (plus tiny bugfixes for ESS + HMC) (TuringLang#2628) * Obviously this single commit will make Gibbs work * Fixes for ESS * Fix HMC call * improve some comments * Fixes to ProduceLogLikelihoodAccumulator * Use LogProbAccumulator for ProduceLogLikelihoodAccumulator * use get_conditioned_gibbs --------- Co-authored-by: Penelope Yong <[email protected]> * "Fixes" for PG-in-Gibbs (TuringLang#2629) * WIP PMCMC work * Fixes to ProduceLogLikelihoodAccumulator * inline definition of `set_retained_vns_del!` * Fix ProduceLogLikelihoodAcc * Remove all uses of `set_retained_vns_del!` * Use nice functions * Remove PG tests with dynamic number of Gibbs-conditioned-observations * Fix essential/container tests * Update pMCMC implementation as per discussion * remove extra printing statements * revert unneeded changes * Add back (some kind of) dynamic model test * fix rebase * Add a todo comment for dynamic model tests --------- Co-authored-by: Markus Hauru <[email protected]> * Use accumulators to fix all logp calculations when sampling (TuringLang#2630) * Use new `getlogjoint` for optimisation * Change getlogjoint -> getlogjoint_internal where needed * Enforce re-evaluation when constructing `Transition` * fix tests * Remove extra evaluations from SGLD and SGHMC * Remove dead `transitions_from_chain` method (used to be part of `predict`) * metadata -> getstats_with_lp * Clean up some stray getlogp * InitContext isn't for 0.37, update comments * Fix merge * Do not re-evaluate model for Prior (TuringLang#2644) * Allow Prior to skip model re-evaluation * remove unneeded `default_chain_type` method * add a test * add a likelihood term too * why not test correctness while we're at it * No need to test AD for SamplingContext{<:HMC} (TuringLang#2645) * change breaking -> main * Remove calls to resetlogp!! & add changelog (TuringLang#2650) * Remove calls to resetlogp!! * Add a changelog for 0.40 * Update HISTORY.md Co-authored-by: Markus Hauru <[email protected]> --------- Co-authored-by: Markus Hauru <[email protected]> * Remove `[sources]` * Unify Turing `Transition`s, fix some tests (TuringLang#2651) * Unify `Transition` methods * Add tests * Add same test for SGLD/SGHMC * Refactor so that it's nice and organised * Fix failing test on 1.10 * just increase the atol * Make addlogprob test more robust * Remove stray `@show` Co-authored-by: Markus Hauru <[email protected]> --------- Co-authored-by: Markus Hauru <[email protected]> * Update changelog for PG in Gibbs --------- Co-authored-by: Penelope Yong <[email protected]> --------- Co-authored-by: Markus Hauru <[email protected]>
TuringLang#2637) * Improve error message for initialization failures with troubleshooting link * Refactor error message for initialization failures to remove redundant information and enhance clarity * fc * simplier * Update test/mcmc/hmc.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * updated error uri * Update test/mcmc/hmc.jl Co-authored-by: Markus Hauru <[email protected]> --------- Co-authored-by: AoifeHughes <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Markus Hauru <[email protected]>
* Suppress info message with verbose=false * Fix changelog typos
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## torfjelde/marginalisation-integration #2662 +/- ##
========================================================================
Coverage ? 58.22%
========================================================================
Files ? 24
Lines ? 1441
Branches ? 0
========================================================================
Hits ? 839
Misses ? 602
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Oh wow, that PR was very old. 😄 Would you mind opening a new PR to main? I think that'll be easier for us to handle too. (To be upfront: I'm mostly away for the next 1.5 weeks, so it may be a couple of weeks before I get to this seriously, if that's alright.) |
Sure, I can open a fresh PR. No particular rush, it will be ready when you get back. |
Fixes some compatibility issues and uses the new
getlogjoint
function instead ofOptimizationContext
.