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

Replace old Gibbs sampler with the experimental one. #2328

Open
wants to merge 79 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
5948253
Replace old Gibbs sampler with the experimental one.
mhauru Sep 23, 2024
5a3e4a6
Remove dead references to experimental
mhauru Sep 23, 2024
09c739d
Remove mention of experimental from JuliaFormatter conf
mhauru Sep 23, 2024
58ebb25
Add tests for deprecated constructor
mhauru Sep 24, 2024
7715732
Fix deprecated Gibbs constructors. Add HISTORY entry.
mhauru Sep 24, 2024
672f7d9
Bump version to 0.35.0
mhauru Sep 24, 2024
7bf5abe
Add Gibbs constructor test for repeat samplers
mhauru Sep 24, 2024
85bcfa5
Fix typo in test/mcmc/ess.jl
mhauru Sep 24, 2024
6f9679a
Use provided rng to initialise VarInfo in Gibbs
mhauru Sep 24, 2024
f247ad9
Fix a typo in GibbsContext
mhauru Oct 8, 2024
a790363
Merge remote-tracking branch 'origin/master' into mhauru/change-gibbs…
mhauru Oct 11, 2024
d19afe1
Fix the Gibbs sampler
mhauru Oct 11, 2024
19598c4
Fix the Gibbs sampler more
mhauru Oct 17, 2024
71f26ca
Remove mentions of old Gibbs sampler from MH docs
mhauru Oct 18, 2024
2454cf1
Merge remote-tracking branch 'origin/master' into mhauru/change-gibbs…
mhauru Oct 21, 2024
d0f57ac
Bump DPPL to 0.28.6
mhauru Oct 21, 2024
1bd0794
Merge remote-tracking branch 'origin/master' into mhauru/change-gibbs…
mhauru Oct 24, 2024
6f5b273
Merge remote-tracking branch 'origin/master' into mhauru/change-gibbs…
mhauru Oct 24, 2024
74b57e7
Redesign GibbsContext, work in progress
mhauru Oct 28, 2024
b16daf5
Fixing new Gibbs, adding a broken test
mhauru Oct 28, 2024
de9e7da
Merge remote-tracking branch 'origin/master' into mhauru/change-gibbs…
mhauru Oct 28, 2024
af802dc
Document and clean up GibbsContext
mhauru Oct 28, 2024
e58d935
Code style and docs improvements to Gibbs
mhauru Oct 28, 2024
b8c3dcd
Change how AdvancedHMC Gibbs state treats momenta
mhauru Oct 29, 2024
da0b740
Remove unnecessary invlinking
mhauru Oct 29, 2024
d984d2b
Change how AdvancedHMC Gibbs state treats momenta, again
mhauru Oct 29, 2024
410d74d
Merge remote-tracking branch 'origin/master' into mhauru/change-gibbs…
mhauru Oct 29, 2024
15ee270
Merge remote-tracking branch 'origin/master' into mhauru/change-gibbs…
mhauru Oct 30, 2024
d52af52
Use setparams!! rather than reset_state!!
mhauru Nov 1, 2024
508ac61
Don't overload setparams\!\! with VarInfo
mhauru Nov 4, 2024
6ff7c59
A fix for ESS in Gibbs
mhauru Nov 5, 2024
934c03e
Remove recompute_logprob!!
mhauru Nov 5, 2024
93010f7
Fix setparams_varinfo!! for MH
mhauru Nov 7, 2024
1576d21
Stop hard coding the leafcontext for MH setparams_varinfo!!
mhauru Nov 7, 2024
96674f8
Fix setparams_varinfo!! for ESS
mhauru Nov 7, 2024
69f14ce
Fix the context used by setparams_varinfo!! ESS
mhauru Nov 7, 2024
00bcdd8
Add GibbsContext type stability tests
mhauru Nov 7, 2024
dc5b0cf
Apply suggestions from code review
mhauru Nov 12, 2024
9205788
Merge remote-tracking branch 'origin/master' into mhauru/change-gibbs…
mhauru Nov 12, 2024
fa366d3
Add clarifying comment
mhauru Nov 12, 2024
4e99870
Add setparams_varinfo!! type bounds
mhauru Nov 12, 2024
da7342e
Fix an import
mhauru Nov 12, 2024
14decaf
Style improvement
mhauru Nov 12, 2024
a7317e8
Improve GibbsContext type stability test
mhauru Nov 12, 2024
7e75caa
Add comment to constructor tests
mhauru Nov 12, 2024
16ba3f8
Fix a Gibbs test
mhauru Nov 12, 2024
d35cbce
Document the methods of `varinfo` better
mhauru Nov 12, 2024
5fa9458
Check whether a sampler is a valid Gibbs component
mhauru Nov 13, 2024
80cc62f
Move varinfo methods where they belong
mhauru Nov 13, 2024
053ecfc
Fix calling of child context in GibbsContext
mhauru Nov 13, 2024
d53350d
Fix Selectors and type stability of Gibbs
mhauru Nov 15, 2024
5d401e1
Fix broken short circuit in MH
mhauru Nov 15, 2024
d57c97c
Stop unnecessary use of Val in GibbsContext
mhauru Nov 18, 2024
5bebff2
Enforce GibbsContext being next to a leaf
mhauru Nov 18, 2024
fdf1347
Fix setparams_varinfo!! for ESS
mhauru Nov 19, 2024
8e8ed0d
Fix a small Gibbs bug
mhauru Nov 19, 2024
2cced8b
Fix Gibbs sampler test
mhauru Nov 19, 2024
e1dbf6c
Add back tests that were accidentally commented out
mhauru Nov 20, 2024
41b25f8
Relax a test tolerance
mhauru Nov 20, 2024
583d297
Add a Gibbs test for dynamic model with ESS
mhauru Nov 26, 2024
cc9510c
Use ESS in Gibbs DEMO_MODELS tests
mhauru Nov 26, 2024
310bee9
Add Gibbs component call order test
mhauru Nov 27, 2024
519ff02
Fix Gibbs linking bug, add tests
mhauru Nov 28, 2024
f9ed562
Make Gibbs constructor more flexible
mhauru Nov 28, 2024
7b0d12b
Introduce RepeatSampler
mhauru Nov 28, 2024
4beb463
Switch gold standard sample Gibbs test back to HMC
mhauru Nov 28, 2024
1041449
Clean up RepeatSamplerTests preamble
mhauru Nov 28, 2024
d17e6ed
Fix RepeatSampler in Gibbs bug
mhauru Nov 28, 2024
d22df39
Rename a function in Gibbs
mhauru Nov 28, 2024
2025ef9
Test HMCDA in Gibbs tests
mhauru Nov 28, 2024
38ac128
Simplify is_target_varname
mhauru Nov 29, 2024
7d6a983
Add suggestions from code review
mhauru Nov 29, 2024
39c2f21
Add a couple of issue references
mhauru Nov 29, 2024
fa81f83
Merge remote-tracking branch 'origin/master' into mhauru/change-gibbs…
mhauru Nov 29, 2024
ff09591
Restructure Gibbs inference tests and reduce iteration counts
mhauru Nov 29, 2024
1f5432f
Reduce another iter count in Gibbs tests
mhauru Nov 29, 2024
74f6ac7
Merge remote-tracking branch 'origin/master' into mhauru/change-gibbs…
mhauru Dec 2, 2024
5f21c84
Add an info print to Gibbs tests
mhauru Dec 2, 2024
a15ce2f
Use StableRNG, relax test tolerance
mhauru Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import_to_using = false
# These ignores should be removed once the relevant PRs are merged/closed.
ignore = [
# https://github.com/TuringLang/Turing.jl/pull/2231/files
"src/experimental/gibbs.jl",
"src/mcmc/abstractmcmc.jl",
"test/experimental/gibbs.jl",
"test/test_utils/numerical_tests.jl",
# https://github.com/TuringLang/Turing.jl/pull/2218/files
"src/mcmc/Inference.jl",
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ jobs:
- "mcmc/hmc.jl"
- "mcmc/abstractmcmc.jl"
- "mcmc/Inference.jl"
- "experimental/gibbs.jl"
- "mcmc/ess.jl"
- "--skip essential/ad.jl mcmc/gibbs.jl mcmc/hmc.jl mcmc/abstractmcmc.jl mcmc/Inference.jl experimental/gibbs.jl mcmc/ess.jl"
- "--skip essential/ad.jl mcmc/gibbs.jl mcmc/hmc.jl mcmc/abstractmcmc.jl mcmc/Inference.jl mcmc/ess.jl"
version:
- '1.7'
- '1'
Expand Down Expand Up @@ -79,7 +78,7 @@ jobs:
- uses: julia-actions/julia-buildpkg@v1
# TODO: Use julia-actions/julia-runtest when test_args are supported
# Custom calls of Pkg.test tend to miss features such as e.g. adjustments for CompatHelper PRs
# Ref https://github.com/julia-actions/julia-runtest/pull/73
# Ref https://github.com/julia-actions/julia-runtest/pull/73
- name: Call Pkg.test
run: julia --color=yes --inline=yes --depwarn=yes --check-bounds=yes --threads=${{ matrix.num_threads }} --project=@. -e 'import Pkg; Pkg.test(; coverage=parse(Bool, ENV["COVERAGE"]), test_args=ARGS)' -- ${{ matrix.test-args }}
- uses: julia-actions/julia-processcoverage@v1
Expand Down
16 changes: 16 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Release 0.35.0

## Breaking changes

0.35.0 introduces a new Gibbs sampler. It's been included in several previous releases as `Turing.Experimental.Gibbs`, but now takes over the old Gibbs sampler, which gets removed completely.

The new Gibbs sampler supports the same user-facing interface as the old one. However, given
that the internals of it having been completely rewritten in a very different manner, there
may be accidental breakage that we haven't anticipated. Please report any you find.

`GibbsConditional` has also been removed. It was never very user-facing, but it was exported, so technically this is breaking.

The old Gibbs constructor relied on being called with several subsamplers, and each of the constructors of the subsamplers would take as arguments the symbols for the variables that they are to sample, e.g. `Gibbs(HMC(:x), MH(:y))`. This constructor has been deprecated, and will be removed in the future. The new constructor works by assigning samplers to either symbols or `VarNames`, e.g. `Gibbs(; x=HMC(), y=MH())` or `Gibbs(@varname(x) => HMC(), @varname(y) => MH())`. This allows more granular specification of which sampler to use for which variable.

Likewise, the old constructor for calling one subsampler more often than another, `Gibbs((HMC(:x), 2), (MH(:y), 1))` has been deprecated. The new way to achieve this effect is to list the same sampler multiple times, e.g. as `hmc = HMC(); mh = MH(); Gibbs(@varname(x) => hmc, @varname(x) => hmc, @varname(y) => mh)`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gibbs(@varname(x) => hmc, @varname(x) => hmc, @varname(y) => mh)

This looks rather awkward. Can we introduce a simple wrapper, Repeated and support:

Gibbs(@varname(x) => Repeated(hmc, n), @varname(y) => mh)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We had a chat about a closely related issue with @torfjelde too, I'll rework the interface around this a bit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I introduced a wrapper sampler: Gibbs(@varname(x) => RepeatSampler(HMC(0.01, 4), 2), @varname(y) => MH())


# Release 0.33.0

## Breaking changes
Expand Down
2 changes: 0 additions & 2 deletions src/Turing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ using .Variational
include("optimisation/Optimisation.jl")
using .Optimisation

include("experimental/Experimental.jl")
include("deprecated.jl") # to be removed in the next minor version release

###########
Expand Down Expand Up @@ -86,7 +85,6 @@ export @model, # modelling
Emcee,
ESS,
Gibbs,
GibbsConditional,
HMC, # Hamiltonian-like sampling
SGLD,
SGHMC,
Expand Down
16 changes: 0 additions & 16 deletions src/experimental/Experimental.jl

This file was deleted.

Loading