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

Add some interface functions to support the new Gibbs sampler in Turing #144

Closed
wants to merge 56 commits into from
Closed
Changes from 3 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
dcf1da9
very incomplete draft
sunxd3 Jul 12, 2024
cdaa663
update `getparams`
sunxd3 Jul 12, 2024
57275f5
Upstream `condition` and `decondition` from `AbstractPPL`
sunxd3 Jul 18, 2024
26027ea
remove `condition` and `decondition`
sunxd3 Jul 22, 2024
6ebab49
add Compat to make new interface functions public
sunxd3 Jul 22, 2024
e1099f9
bump minor version
sunxd3 Jul 22, 2024
95d781b
bump minor version instead
sunxd3 Jul 22, 2024
f05f293
unfinished gibbs example
sunxd3 Aug 6, 2024
590d37f
some updates
sunxd3 Aug 14, 2024
3afc232
more progress; still need to deal with w being on simplex
sunxd3 Aug 15, 2024
55dbab5
bit of format
sunxd3 Aug 15, 2024
67ff8e8
results is wrong
sunxd3 Aug 15, 2024
f758a4c
Apply suggestions from code review
sunxd3 Aug 15, 2024
7d0ba7c
add hierarchical normal problem
sunxd3 Aug 22, 2024
1ab6dd9
some updates; add doc
sunxd3 Aug 23, 2024
923c116
move folder into test
sunxd3 Aug 23, 2024
63028d3
setup as a test
sunxd3 Aug 23, 2024
44de81c
add to doc
sunxd3 Aug 23, 2024
be43178
format
sunxd3 Aug 23, 2024
1a6e0d5
bump patch version
sunxd3 Aug 23, 2024
6b60b72
reverse version bump -- already done
sunxd3 Aug 23, 2024
c58b39a
remove dep on `Compat`
sunxd3 Aug 23, 2024
ac0ce7a
updates to doc
sunxd3 Aug 23, 2024
280eaf1
update gibbs to add to the src folder
sunxd3 Sep 8, 2024
b262ea9
update mh code
sunxd3 Sep 8, 2024
c47ade4
update code further
sunxd3 Sep 8, 2024
8d29ad3
fix test errors
sunxd3 Sep 9, 2024
c28a75a
format
sunxd3 Sep 9, 2024
1382054
fix doctest error
sunxd3 Sep 9, 2024
8962d40
tidy up
sunxd3 Sep 9, 2024
dc6001c
updates
sunxd3 Sep 17, 2024
e194108
Update test/gibbs_example/mh.jl
sunxd3 Sep 17, 2024
64eb0e4
fix error
sunxd3 Sep 17, 2024
9361c39
typo fix
sunxd3 Sep 17, 2024
39c4d87
Update src/gibbs.jl
sunxd3 Sep 18, 2024
7f889cf
rename gibbs test file to prepare for moving
sunxd3 Sep 20, 2024
62a2332
move gibbs.jl
sunxd3 Sep 20, 2024
6132f0c
update code
sunxd3 Sep 20, 2024
af208bc
updates
sunxd3 Sep 22, 2024
fd472df
rework the code; still not type stable
sunxd3 Sep 22, 2024
4306aee
fix test
sunxd3 Sep 22, 2024
b798b2e
update doc -- need proofread
sunxd3 Sep 22, 2024
3ed5cb3
fix 1.6 struct field splatting compat issue
sunxd3 Sep 22, 2024
6fde198
update code and doc
sunxd3 Sep 27, 2024
c7f577d
relax test error
sunxd3 Sep 28, 2024
8f11a15
rename gibbs markdown file
sunxd3 Sep 28, 2024
48a160d
change title
sunxd3 Sep 28, 2024
8d74889
update code and note
sunxd3 Oct 1, 2024
bceb510
fix doc example
sunxd3 Oct 1, 2024
c177271
try to fix doc example error
sunxd3 Oct 1, 2024
bdba893
fix doc deps
sunxd3 Oct 1, 2024
e7e2870
fix more doc example error
sunxd3 Oct 1, 2024
80df187
minor update
sunxd3 Oct 1, 2024
076e431
Apply suggestions from code review
sunxd3 Oct 3, 2024
4293868
Update docs/src/state_interface.md
sunxd3 Oct 3, 2024
1cee0ab
Update docs/src/state_interface.md
sunxd3 Oct 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
48 changes: 48 additions & 0 deletions src/AbstractMCMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,54 @@ The `MCMCSerial` algorithm allows users to sample serially, with no thread or pr
"""
struct MCMCSerial <: AbstractMCMCEnsemble end

"""
decondition(conditioned_model)

Remove the conditioning (i.e., observation data) from `conditioned_model`, turning it into a
generative model over prior and observed variables.

The invariant

```
m == condition(decondition(m), obs)
```

should hold for models `m` with conditioned variables `obs`.
"""
function decondition end

"""
condition(model, observations)

Condition the generative model `model` on some observed data, creating a new model of the (possibly
unnormalized) posterior distribution over them.

`observations` can be of any supported internal trace type, or a fixed probability expression.
sunxd3 marked this conversation as resolved.
Show resolved Hide resolved

The invariant

```
m = decondition(condition(m, obs))
```

should hold for generative models `m` and arbitrary `obs`.
"""
function condition end

"""
recompute_logprob!!(rng, model, sampler, state)

Recompute the log-probability of the `model` based on the given `state` and return the resulting state.
"""
function recompute_logprob!!(rng, model, sampler, state) end

"""
getparams(state)

Returns the values of the parameters in the state.
"""
function getparams(state) end
sunxd3 marked this conversation as resolved.
Show resolved Hide resolved

include("samplingstats.jl")
include("logging.jl")
include("interface.jl")
Expand Down
Loading