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

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
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.


# 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