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

Attempt at implementation of VarNamedVector (Metadata alternative) #555

Merged
merged 222 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 142 commits
Commits
Show all changes
222 commits
Select commit Hold shift + click to select a range
5af1afa
initial implementation of VarNameVector
torfjelde Oct 31, 2023
8ce53f7
added some hacky getval and getdist get things to work for VarInfo
torfjelde Nov 7, 2023
fc6a051
Apply suggestions from code review
torfjelde Nov 7, 2023
7cd599d
added arbitrary metadata field as discussed
torfjelde Nov 12, 2023
ed0a757
renamed idcs to varname_to_index
torfjelde Nov 12, 2023
4ebd252
renamed vns to varnames for VarNameVector
torfjelde Nov 12, 2023
9f12c9a
added keys impl for Metadata
torfjelde Nov 12, 2023
5a15121
added push! and update! for VarNameVector
torfjelde Nov 13, 2023
edde2c1
added getindex_raw! and setindex_raw! for VarNameVector
torfjelde Nov 13, 2023
ed46002
added `iterate` and `convert` (for `AbstractDict) impls for `VarNameV…
torfjelde Nov 13, 2023
5b00059
make the key and eltype part of the `VarNameVector` type
torfjelde Nov 13, 2023
bef7e0a
added more tests for VarNameVector
torfjelde Nov 13, 2023
006ee8d
formatting
torfjelde Nov 13, 2023
9802811
more testing for VarNameVector
torfjelde Nov 13, 2023
88b1721
minor changes to some comments
torfjelde Nov 13, 2023
ca7b173
added a bunch more tests for VarNameVector + several bugfixes in the …
torfjelde Nov 13, 2023
fb01b94
formatting
torfjelde Nov 13, 2023
9634839
added `similar` implementation for `VarNameVector`
torfjelde Nov 13, 2023
5179f6f
formatting
torfjelde Nov 13, 2023
9f632bb
removed debug statement
torfjelde Nov 13, 2023
3c210f7
made VarInfo slighly more generic wrt. underlying metadata
torfjelde Nov 13, 2023
8bf6589
Merge branch 'master' into torfjelde/varnamevector
torfjelde Nov 14, 2023
8b2720f
fixed incorrect behavior in `keys` for `Metadata`
torfjelde Nov 14, 2023
9fa6446
minor style changes to VarNameVector tests
torfjelde Nov 14, 2023
0900c57
style
torfjelde Nov 14, 2023
1f7e633
added testing of `update!` with smaller sizes and fixed bug related t…
torfjelde Nov 14, 2023
8d05586
formatting
torfjelde Nov 14, 2023
7801fe1
move functionality related to `push!` for `VarNameVector` into `push!`
torfjelde Nov 14, 2023
cdc2373
Update src/varnamevector.jl
torfjelde Nov 16, 2023
d2d776d
Merge branch 'master' into torfjelde/varnamevector
torfjelde Nov 20, 2023
ae4bcb7
several fixes to make sampling with VarNameVector + initiall tests for
torfjelde Dec 30, 2023
97e1bcc
VarInfo + VarNameVector tests for all demo models
torfjelde Dec 30, 2023
be3c1b4
Merge remote-tracking branch 'origin/torfjelde/varnamevector' into to…
torfjelde Dec 30, 2023
ad343f3
Apply suggestions from code review
torfjelde Dec 30, 2023
f707b25
added docs on the design of `VarNameVector`
torfjelde Dec 31, 2023
4e7af1d
Merge branch 'master' into torfjelde/varnamevector
torfjelde Dec 31, 2023
f1faf18
Apply suggestions from code review
torfjelde Dec 31, 2023
87d3d01
added note on `update!`
torfjelde Dec 31, 2023
9c3b265
further elaboration of the design of `VarInfo` and `VarNameVector`
torfjelde Jan 1, 2024
958c66b
more writing improvements
torfjelde Jan 1, 2024
74c6efd
added docstring to `has_inactive_ranges` and `inactive_ranges_sweep!`
torfjelde Jan 1, 2024
d9ea878
moved docs on `VarInfo` design to a separate internals section
torfjelde Jan 1, 2024
5acce98
writing improvements for internal docs
torfjelde Jan 1, 2024
6f95cdd
further motivation of the design choices made in `VarNameVector`
torfjelde Jan 1, 2024
38a4b08
improved writing
torfjelde Jan 1, 2024
60edd10
VarNameVector is now grown as much as needed
torfjelde Jan 1, 2024
3f9d34f
updated `delete!`
torfjelde Jan 2, 2024
fb822b5
Significant changes to implementation of `VarNameVector`:
torfjelde Jan 2, 2024
66bc090
added `copy` when constructing `VectorVarInfo` from `VarInfo`
torfjelde Jan 2, 2024
ccd86f2
added missing `isempty` impl
torfjelde Jan 2, 2024
1d4a000
remove impl of `iterate` and instead implemented `pairs` and `values`…
torfjelde Jan 2, 2024
9a16dd1
added missing `empty!` for `num_inactive`
torfjelde Jan 2, 2024
e49b762
removed redundant `shift_left!` methd
torfjelde Jan 2, 2024
2b445c9
fixed `delete!` for `VarNameVector`
torfjelde Jan 2, 2024
e3c2633
added `is_contiguous` as an alterantive to `!has_inactive`
torfjelde Jan 2, 2024
19a829c
updates to internal docs
torfjelde Jan 2, 2024
a358bc4
renamed `sweep_inactive_ranges!` to `contiguify!`
torfjelde Jan 2, 2024
46be8d5
improvements to internal docs
torfjelde Jan 2, 2024
57d688e
more improvements to internal docs
torfjelde Jan 2, 2024
0968a07
moved additional methods description in internals to earlier in the doc
torfjelde Jan 2, 2024
0d008a4
moved internals docs to a separate directory and split into files
torfjelde Jan 2, 2024
ccd0d64
more improvements to internals doc
torfjelde Jan 2, 2024
7c45e67
formatting
torfjelde Jan 2, 2024
373215b
added tests for `delete!` and fixed reference to old method
torfjelde Jan 2, 2024
0cdafbf
addition to `delete!` test
torfjelde Jan 2, 2024
51c041f
added `values_as` impls for `VarNameVector`
torfjelde Jan 2, 2024
20b3742
added docs for `replace_valus` and `values_as` for `VarNameVector`
torfjelde Jan 2, 2024
ef6c618
fixed doctest
torfjelde Jan 2, 2024
8a1209c
formatting
torfjelde Jan 2, 2024
adeadf0
temporarily disable doctests so we can build docs
torfjelde Jan 2, 2024
7ff179d
added missing compat entry for ForwardDiff in docs
torfjelde Jan 2, 2024
c7ec08a
moved some shared code into methods to make things a bit cleaner
torfjelde Jan 3, 2024
c5a5e58
added impl of `merge` for `VarNameVector`
torfjelde Jan 3, 2024
c376d95
renamed a few variables in `merge` impl for `VarNameVector`
torfjelde Jan 3, 2024
f71baa5
forgot to include some changes in previous commit
torfjelde Jan 3, 2024
af25f3c
added impl of `subset` for `VarNameVector`
torfjelde Jan 3, 2024
c28f076
fixed `pairs` impl for `VarNameVector`
torfjelde Jan 3, 2024
f5d2c63
added missing impl of `subset` for `VectorVarInfo`
torfjelde Jan 3, 2024
3eb6c7f
added missing impl of `merge_metadata` for `VarNameVector`
torfjelde Jan 3, 2024
9ba8144
added a bunch of `from_vec_transform` and `tovec` impls to make
torfjelde Jan 3, 2024
acd6951
make default args use `from_vec_transform` rather than `FromVec`
torfjelde Jan 3, 2024
790f743
fixed `values_as` fro `VarInfo` with `VarNameVector` as `metadata`
torfjelde Jan 3, 2024
c474bb0
fixed impl of `getindex_raw` when using integer index for `VarNameVec…
torfjelde Jan 4, 2024
8251463
added tests for `getindex` with `Int` index for `VarNameVector`
torfjelde Jan 4, 2024
5df7031
fix for `setindex!` and `setindex_raw!` for `VarNameVector`
torfjelde Jan 4, 2024
683b776
introduction of `from_vec_transform` and `tovec` and its usage in `Va…
torfjelde Jan 19, 2024
4dae00d
moved definition of `is_splat_symbol` to the file where it's used
torfjelde Jan 19, 2024
e3b52a4
added `VarInfo` constructor with vector input for `VectorVarInfo`
torfjelde Jan 19, 2024
9626be1
make `extract_priors` take the `rng` as an argument
torfjelde Jan 19, 2024
e731fd6
added `replace_values` for `Metadata`
torfjelde Jan 19, 2024
0785abf
make link and invlink act on the `metadata` field for `VarInfo` +
torfjelde Jan 19, 2024
b3e0955
added temporary defs of `with_logabsdet_jacobian` and `inverse` for
torfjelde Jan 19, 2024
ff963ce
added invlink_with_logpdf overload for `ThreadSafeVarInfo`
torfjelde Jan 19, 2024
03f2b2b
added `is_transformed` field to `VarNameVector`
torfjelde Jan 19, 2024
949b33a
removed unnecessary defintions of `with_logabsdet_jacobian` and
torfjelde Jan 19, 2024
cc5ecc4
fixed issue where we were storing the wrong transformations in `VarNa…
torfjelde Jan 19, 2024
1aae1b4
make sure `extract_priors` doesn't mutate the `varinfo`
torfjelde Jan 19, 2024
8e0853d
updated `similar` for `VarNameVector` and fixed `invlink` for `VarNam…
torfjelde Jan 19, 2024
229b168
added handling of `is_transformed` in `merge` for `VarNameVector`
torfjelde Jan 19, 2024
c581dcf
removed unnecesasry `deepcopy` from outer `link`
torfjelde Jan 19, 2024
b4d3f55
updated `push!` to also `push!` on `is_transformed`
torfjelde Jan 19, 2024
ed1d006
skip tests for mutating linking when using VarNameVector
torfjelde Jan 19, 2024
f132209
use same projection for `Cholesky` in `VarNameVector` as in `VarInfo`
torfjelde Jan 19, 2024
49454de
fixed `settrans!!` for `VarInfo` with `VarNameVector`
torfjelde Jan 19, 2024
01ff2dd
fixed bug in `set_flag!`
torfjelde Jan 19, 2024
20adedf
fixed another typo
torfjelde Jan 19, 2024
8f9566a
fixed return values of `settrans!!`
torfjelde Jan 19, 2024
5532046
updated static transformation tests
torfjelde Jan 20, 2024
3c5d2ac
Update test/simple_varinfo.jl
torfjelde Jan 20, 2024
317d969
Merge branch 'master' into torfjelde/varnamevector
torfjelde Jan 20, 2024
f8441ea
Merge remote-tracking branch 'origin/torfjelde/varnamevector' into to…
torfjelde Jan 25, 2024
ab16323
Merge branch 'master' into torfjelde/varnamevector
torfjelde Jan 25, 2024
a9be219
removed unnecessary impl of `extract_priors`
torfjelde Jan 25, 2024
53c8d33
make `short_varinfo_name` of `TypedVarInfo` a bit more informative
torfjelde Jan 25, 2024
61d85ad
moved impl of `has_varnamevector` for `ThreadSafeVarInfo`
torfjelde Jan 25, 2024
9ace554
added back `extract_priors` impl as we do need it
torfjelde Jan 25, 2024
67c9821
forgot to include tests for `VarNameVector` in `runtests.jl`
torfjelde Jan 25, 2024
32a2d31
fix for `relax_container_types` in `test/varnamevector.jl`
torfjelde Jan 25, 2024
b3bb42d
fixed `need_transforms_relaxation`
torfjelde Jan 26, 2024
25ff2b1
updated some tests to not refer directly to `FromVec`
torfjelde Jan 28, 2024
004f038
introduce `from_internal_transform` and its siblings
torfjelde Jan 28, 2024
38c89bd
remove `with_logabsdet_jacobian_and_reconstruct` in favour of
torfjelde Jan 28, 2024
218dc23
added `internal_to_linked_internal_transform` + fixed a few bugs in
torfjelde Jan 28, 2024
1df4293
added `linked_internal_to_internal_transform` as a complement to `int…
torfjelde Jan 28, 2024
f8df896
fixed bugs in `invlink` for `VarInfo` using `linked_internal_to_inter…
torfjelde Jan 28, 2024
d62f26a
more work on removing calls to `reconstruct`
torfjelde Jan 28, 2024
b4517d6
removed redundant comment
torfjelde Jan 28, 2024
b7d4754
added `from_linked_vec_transform` specialization for `LKJ`
torfjelde Jan 28, 2024
0244dd9
more work on removing references to `reconstruct`
torfjelde Jan 28, 2024
e886d07
added `copy` in `values_from_metadata` to preserve behavior and avoid
torfjelde Jan 28, 2024
2af6605
remove `reconstruct_and_link` and `invlink_and_reconstruct`
torfjelde Jan 28, 2024
a0664d7
replaced references to `link_and_reconstruct` and `invlink_and_recons…
torfjelde Jan 28, 2024
f2d59b2
introduced `recombine` and replaced calls to `reconstruct` with `n` s…
torfjelde Jan 28, 2024
e3bfa76
completely removed `reconstruct`
torfjelde Jan 28, 2024
c0aef81
renamed `maybe_reconstruct_and_link` to `to_maybe_linked_internal` and
torfjelde Jan 28, 2024
f7c0853
added impls of `from_*_internal_transform` for `ThreadSafeVarInfo`
torfjelde Jan 30, 2024
77b835e
removed `reconstruct` from docs and from exports
torfjelde Jan 30, 2024
b83c262
renamed `getval` to `getindex_internal` and made `dist` an optional
torfjelde Jan 31, 2024
c4faf3e
updated docs + added description of how internals of transforms work
torfjelde Jan 31, 2024
c8d9695
added a bunch of illustrations for the transforms docs + dot files us…
torfjelde Jan 31, 2024
95dc8e3
temporarily removed `VarNameVector` completely
torfjelde Jan 31, 2024
8930f9c
formatting
torfjelde Jan 31, 2024
e45b668
Update docs/src/internals/transformations.md
torfjelde Jan 31, 2024
0e71092
Update docs/src/internals/transformations.md
torfjelde Jan 31, 2024
2de9ac9
removed refs to VectorVarInfo
torfjelde Jan 31, 2024
9b71428
added impls of `from_internal_transform` for `ThreadSafeVarInfo`
torfjelde Feb 1, 2024
786e9bf
reverted accidental removal of old `VarInfo` constructor
torfjelde Feb 1, 2024
f1fe42c
fixed incorrect `recombine` call
torfjelde Feb 1, 2024
2273954
removed undefined refs to `VarNameVector` stuff in `setup_varinfos`
torfjelde Feb 1, 2024
ab7c189
bump minior version because Turing breaks
torfjelde Feb 1, 2024
3a86601
fix: was using `from_linked_internal_transform` in
torfjelde Feb 1, 2024
28c7d85
removed `getindex_raw`
torfjelde Feb 1, 2024
59514d6
removed redundant docstrings
torfjelde Feb 1, 2024
cdc882b
fixed tests
torfjelde Feb 1, 2024
57ba7c0
fixed comparisons in tests
torfjelde Feb 1, 2024
902e59c
try relative references for images in transformation docs
torfjelde Feb 1, 2024
d7aba55
another attempt at fixing asset-references
torfjelde Feb 3, 2024
b0dd2f8
Merge branch 'master' into torfjelde/transformations
torfjelde Feb 3, 2024
1f51203
fixed getindex diagrams in docs
torfjelde Feb 3, 2024
0eb79b1
minor changes to comments
torfjelde Feb 3, 2024
071bebf
remove Combinatorics as a test dep, as it's not needed for this PR
torfjelde Feb 3, 2024
bbdc060
reverted unnecessary change
torfjelde Feb 3, 2024
e2f4d18
disable type-stability tests for models on older Julia versions
torfjelde Feb 3, 2024
3d823ac
removed seemingly completely unused impl of `setval!`
torfjelde Feb 3, 2024
54792f4
Revert "temporarily removed `VarNameVector` completely"
torfjelde Feb 3, 2024
ff68206
Revert "remove Combinatorics as a test dep, as it's not needed for th…
torfjelde Feb 6, 2024
9b1014d
Merge remote-tracking branch 'origin/master' into torfjelde/varnameve…
mhauru Aug 22, 2024
19978ec
More work on `VarNameVector` (#637)
mhauru Sep 3, 2024
95668eb
Merge remote-tracking branch 'origin/master' into torfjelde/varnameve…
mhauru Sep 3, 2024
1e4efe6
Bump Bijectors dependecy
mhauru Sep 3, 2024
3ee9832
Remove dead TODO note
mhauru Sep 3, 2024
26753e9
Remove old TODOs, improve VNV invlinking
mhauru Sep 3, 2024
ea18e1f
Fix from_vec_transform for 0-dim arrays
mhauru Sep 4, 2024
ffbf2ad
Fix unflatten for VarInfo
mhauru Sep 4, 2024
f077f4a
Fix some VarInfo index getters
mhauru Sep 4, 2024
e27af80
Change how VNV handles transformations, and other VNV stuff
mhauru Sep 4, 2024
b5677b4
Small docs fixes
mhauru Sep 4, 2024
9d1c8d3
Merge remote-tracking branch 'origin/master' into torfjelde/varnameve…
mhauru Sep 4, 2024
b778082
Small fixes all over for VNV
mhauru Sep 5, 2024
9750e60
Add comments
mhauru Sep 5, 2024
9ecc506
Fix some tests
mhauru Sep 5, 2024
3f1b9a2
Change long string formatting to support Julia 1.6
mhauru Sep 5, 2024
9145965
Small changes to ReshapeTransformation
mhauru Sep 5, 2024
937956d
Revert unrelated changes to ReverseDiff extension
mhauru Sep 5, 2024
4fbe5d2
Improve VarNamedVector VarInfo testing
mhauru Sep 5, 2024
9f11e7b
Fix some depwarns
mhauru Sep 5, 2024
86d97ae
Improvements to test/simple_varinfo.jl
mhauru Sep 5, 2024
2535517
Fix for unset_flag!, better docstring
mhauru Sep 5, 2024
93ef3ee
Add a comment about hasvalue/getvalue
mhauru Sep 5, 2024
f35eca6
Add @non_differentiable calls to work around Zygote limitations
mhauru Sep 9, 2024
d55fc00
Fix docs, workaround Zygote issue
mhauru Sep 9, 2024
5bbba91
Remove outdated workaround
mhauru Sep 17, 2024
851630f
Move has_varnamedvector(varinfo::VarInfo) to abstract_varinfo.jl
mhauru Sep 17, 2024
45c89c4
Make copies of logp and num_produce in subset
mhauru Sep 17, 2024
30252dc
Rename getindex_raw to getindex_internal
mhauru Sep 17, 2024
be77c36
Add push!(::VarNamedVector, ::Pair)
mhauru Sep 17, 2024
8b5bd47
Improve VarNamedVector docs
mhauru Sep 24, 2024
466acb2
Simplify VarNamedVector constructors
mhauru Sep 24, 2024
40909dd
Change how VNV setindex! et al work
mhauru Oct 2, 2024
a9a6ce2
More improvements to VNV setters and their tests
mhauru Oct 2, 2024
3cdd1d1
Fix style issues in VNV
mhauru Oct 2, 2024
ad06300
Update VNV docs. Add haskey to VarInfo
mhauru Oct 2, 2024
380ef42
Merge remote-tracking branch 'origin/master' into torfjelde/varnameve…
mhauru Oct 2, 2024
a203ab7
Fix VarInfo docs
mhauru Oct 2, 2024
775284d
Disable a test that only works for VectorVarInfo
mhauru Oct 2, 2024
79c3a81
Fix bug in isempty(::TypedVarInfo)
mhauru Oct 2, 2024
1f45e76
Make some doctests platform independent
mhauru Oct 3, 2024
2ffbca4
Merge remote-tracking branch 'origin/master' into torfjelde/varnameve…
mhauru Oct 3, 2024
7fcc7df
Better implementation of haskey(::VarInfo, ::VarName)
mhauru Oct 3, 2024
567c4bc
Improve haskey for VarInfo
mhauru Oct 3, 2024
172d128
Make a VNV doctest more robust
mhauru Oct 3, 2024
186a846
Remote IndexStyle for VNV
mhauru Oct 3, 2024
5508370
Clean up an old comment
mhauru Oct 3, 2024
25b85b4
Fix haskey(::VarInfo, ::VarName)
mhauru Oct 3, 2024
eb5577b
Clarify a TODO note in varinfo.jl
mhauru Oct 4, 2024
b3f92c2
Reintroduce Int indexing to VNV
mhauru Oct 4, 2024
65c94ca
Stop exporting any VNV stuff
mhauru Oct 4, 2024
47428c7
Fix docs
mhauru Oct 4, 2024
c966984
Revert default VarInfo metadata type to Metadata
mhauru Oct 7, 2024
e013926
Fix a few trivial issues with Metadata
mhauru Oct 7, 2024
ed747a4
Docs bug fix
mhauru Oct 7, 2024
b23d4e2
Fix type constraint
mhauru Oct 7, 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: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54"
Expand All @@ -14,6 +15,7 @@ DataStructures = "0.18"
Distributions = "0.25"
Documenter = "1"
FillArrays = "0.13, 1"
ForwardDiff = "0.10"
LogDensityProblems = "2"
MCMCChains = "5, 6"
MLUtils = "0.3, 0.4"
Expand Down
2 changes: 2 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ makedocs(;
"Home" => "index.md",
"API" => "api.md",
"Tutorials" => ["tutorials/prob-interface.md"],
"Internals" => ["internals/transformations.md"],
],
checkdocs=:exports,
doctest=false,
)

deploydocs(; repo="github.com/TuringLang/DynamicPPL.jl.git", push_preview=true)
107 changes: 54 additions & 53 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,62 @@ Please see the documentation of [AbstractPPL.jl](https://github.com/TuringLang/A

### Data Structures of Variables

DynamicPPL provides different data structures for samples from the model and their log density.
All of them are subtypes of [`AbstractVarInfo`](@ref).
DynamicPPL provides different data structures used in for storing samples and accumulation of the log-probabilities, all of which are subtypes of [`AbstractVarInfo`](@ref).

```@docs
AbstractVarInfo
```

But exactly how a [`AbstractVarInfo`](@ref) stores this information can vary.

#### `VarInfo`

```@docs
VarInfo
TypedVarInfo
```

One main characteristic of [`VarInfo`](@ref) is that samples are stored in a linearized form.

```@docs
link!
invlink!
```

```@docs
set_flag!
unset_flag!
is_flagged
```

For Gibbs sampling the following functions were added.

```@docs
setgid!
updategid!
```

The following functions were used for sequential Monte Carlo methods.

```@docs
get_num_produce
set_num_produce!
increment_num_produce!
reset_num_produce!
setorder!
set_retained_vns_del_by_spl!
```

```@docs
Base.empty!
```

#### `SimpleVarInfo`

```@docs
SimpleVarInfo
```

### Common API

#### Accumulation of log-probabilities
Expand All @@ -221,6 +270,7 @@ resetlogp!!
keys
getindex
DynamicPPL.getindex_raw
DynamicPPL.getindex_internal
push!!
empty!!
isempty
Expand Down Expand Up @@ -248,8 +298,9 @@ DynamicPPL.invlink
DynamicPPL.link!!
DynamicPPL.invlink!!
DynamicPPL.default_transformation
DynamicPPL.link_transform
DynamicPPL.invlink_transform
DynamicPPL.maybe_invlink_before_eval!!
DynamicPPL.reconstruct
```

#### Utils
Expand All @@ -262,56 +313,6 @@ DynamicPPL.varname_leaves
DynamicPPL.varname_and_value_leaves
```

#### `SimpleVarInfo`

```@docs
SimpleVarInfo
```

#### `VarInfo`

Another data structure is [`VarInfo`](@ref).

```@docs
VarInfo
TypedVarInfo
```

One main characteristic of [`VarInfo`](@ref) is that samples are stored in a linearized form.

```@docs
link!
invlink!
```

```@docs
set_flag!
unset_flag!
is_flagged
```

For Gibbs sampling the following functions were added.

```@docs
setgid!
updategid!
```

The following functions were used for sequential Monte Carlo methods.

```@docs
get_num_produce
set_num_produce!
increment_num_produce!
reset_num_produce!
setorder!
set_retained_vns_del_by_spl!
```

```@docs
Base.empty!
```

### Evaluation Contexts

Internally, both sampling and evaluation of log densities are performed with [`AbstractPPL.evaluate!!`](@ref).
Expand Down
17 changes: 17 additions & 0 deletions docs/src/assets/images/transformations-assume-without-istrans.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
digraph {
# `assume` block
subgraph cluster_assume {
label = "assume";
fontname = "Courier";

assume [shape=box, label=< assume(varinfo, <FONT COLOR="#3B6EA8">@varname</FONT>(x), Normal())>, fontname="Courier"];
without_linking_assume [shape=box, label="f = from_internal_transform(varinfo, varname, dist)", fontname="Courier"];
with_logabsdetjac [shape=box, label="x, logjac = with_logabsdet_jacobian(f, assume_internal(varinfo, varname, dist))", fontname="Courier"];
return_assume [shape=box, label=< <FONT COLOR="#3B6EA8">return</FONT> x, logpdf(dist, x) - logjac, varinfo >, style=dashed, fontname="Courier"];

assume -> without_linking_assume;
without_linking_assume -> with_logabsdetjac;
with_logabsdetjac -> return_assume;
}
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions docs/src/assets/images/transformations-assume.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
digraph {
# `assume` block
subgraph cluster_assume {
label = "assume";
fontname = "Courier";

assume [shape=box, label=< assume(varinfo, <FONT COLOR="#3B6EA8">@varname</FONT>(x), Normal())>, fontname="Courier"];
iflinked_assume [label=< <FONT COLOR="#3B6EA8">if</FONT> istrans(varinfo, varname) >, fontname="Courier"];
without_linking_assume [shape=box, label="f = from_internal_transform(varinfo, varname, dist)", fontname="Courier"];
with_linking_assume [shape=box, label="f = from_linked_internal_transform(varinfo, varname, dist)", fontname="Courier"];
with_logabsdetjac [shape=box, label="x, logjac = with_logabsdet_jacobian(f, assume_internal(varinfo, varname, dist))", fontname="Courier"];
return_assume [shape=box, label=< <FONT COLOR="#3B6EA8">return</FONT> x, logpdf(dist, x) - logjac, varinfo >, style=dashed, fontname="Courier"];

assume -> iflinked_assume;
iflinked_assume -> without_linking_assume [label=< <FONT COLOR="#97365B">false</FONT>>, fontname="Courier"];
iflinked_assume -> with_linking_assume [label=< <FONT COLOR="#97365B">true</FONT>>, fontname="Courier"];
without_linking_assume -> with_logabsdetjac;
with_linking_assume -> with_logabsdetjac;
with_logabsdetjac -> return_assume;
}
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions docs/src/assets/images/transformations-getindex-with-dist.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
digraph {
# `getindex` block
subgraph cluster_getindex {
label = "getindex";
fontname = "Courier";

getindex [shape=box, label=< x = getindex(varinfo, <FONT COLOR="#3B6EA8">@varname</FONT>(x), Normal()) >, fontname="Courier"];
iflinked_getindex [label=< <FONT COLOR="#3B6EA8">if</FONT> istrans(varinfo, varname) >, fontname="Courier"];
without_linking_getindex [shape=box, label="f = from_internal_transform(varinfo, varname, dist)", fontname="Courier"];
with_linking_getindex [shape=box, label="f = from_internal_transform(varinfo, varname, dist)", fontname="Courier"];
return_getindex [shape=box, label=< <FONT COLOR="#3B6EA8">return</FONT> f(getindex_internal(varinfo, varname)) >, style=dashed, fontname="Courier"];

getindex -> iflinked_getindex;
iflinked_getindex -> without_linking_getindex [label=< <FONT COLOR="#97365B">false</FONT>>, fontname="Courier"];
iflinked_getindex -> with_linking_getindex [label=< <FONT COLOR="#97365B">true</FONT>>, fontname="Courier"];
without_linking_getindex -> return_getindex;
with_linking_getindex -> return_getindex;
}
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions docs/src/assets/images/transformations-getindex-without-dist.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
digraph {
# `getindex` block
subgraph cluster_getindex {
label = "getindex";
fontname = "Courier";

getindex [shape=box, label=< x = getindex(varinfo, <FONT COLOR="#3B6EA8">@varname</FONT>(x)) >, fontname="Courier"];
iflinked_getindex [label=< <FONT COLOR="#3B6EA8">if</FONT> istrans(varinfo, varname) >, fontname="Courier"];
without_linking_getindex [shape=box, label="f = from_internal_transform(varinfo, varname)", fontname="Courier"];
with_linking_getindex [shape=box, label="f = from_internal_transform(varinfo, varname)", fontname="Courier"];
return_getindex [shape=box, label=< <FONT COLOR="#3B6EA8">return</FONT> f(getindex_internal(varinfo, varname)) >, style=dashed, fontname="Courier"];

getindex -> iflinked_getindex;
iflinked_getindex -> without_linking_getindex [label=< <FONT COLOR="#97365B">false</FONT>>, fontname="Courier"];
iflinked_getindex -> with_linking_getindex [label=< <FONT COLOR="#97365B">true</FONT>>, fontname="Courier"];
without_linking_getindex -> return_getindex;
with_linking_getindex -> return_getindex;
}
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions docs/src/assets/images/transformations.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
digraph {
# Nodes.
tilde_node [shape=box, label="x ~ Normal()", fontname="Courier"];
base_node [shape=box, label=< vn = <FONT COLOR="#3B6EA8">@varname</FONT>(x)<BR/>dist = Normal()<BR/>x, vi = ... >, fontname="Courier"];
assume [shape=box, label="assume(vn, dist, vi)", fontname="Courier"];

iflinked [label=< <FONT COLOR="#3B6EA8">if</FONT> istrans(vi, vn) >, fontname="Courier"];

without_linking [shape=box, label="f = from_internal_transform(vi, vn, dist)", styled=dashed, fontname="Courier"];
with_linking [shape=box, label="f = from_linked_internal_transform(vi, vn, dist)", styled=dashed, fontname="Courier"];

with_logabsdetjac [shape=box, label="x, logjac = with_logabsdet_jacobian(f, getindex_internal(vi, vn, dist))", styled=dashed, fontname="Courier"];
return [shape=box, label=< <FONT COLOR="#3B6EA8">return</FONT> x, logpdf(dist, x) - logjac, vi >, styled=dashed, fontname="Courier"];

# Edges.
tilde_node -> base_node [style=dashed, label=< <FONT COLOR="#3B6EA8">@model</FONT>>, fontname="Courier"]
base_node -> assume [style=dashed, label=" tilde-pipeline", fontname="Courier"];

assume -> iflinked;

iflinked -> without_linking [label=< <FONT COLOR="#97365B">false</FONT>>, fontname="Courier"];
iflinked -> with_linking [label=< <FONT COLOR="#97365B">true</FONT>>, fontname="Courier"];

without_linking -> with_logabsdetjac;
with_linking -> with_logabsdetjac;

with_logabsdetjac -> return;
}
Binary file added docs/src/assets/images/transformations.dot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading