Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ Leaf contexts require no changes, apart from a removal of the `NodeTrait` functi
`ConditionContext` and `PrefixContext` are no longer exported.
You should not need to use these directly, please use `AbstractPPL.condition` and `DynamicPPL.prefix` instead.

#### ParamsWithStats

In the 'stats' part of `DynamicPPL.ParamsWithStats`, the log-joint is now consistently represented with the key `logjoint` instead of `lp`.

#### Miscellaneous

Removed the method `returned(::Model, values, keys)`; please use `returned(::Model, ::AbstractDict{<:VarName})` instead.
Expand Down
4 changes: 2 additions & 2 deletions src/chains.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function ParamsWithStats(
(
logprior=DynamicPPL.getlogprior(varinfo),
loglikelihood=DynamicPPL.getloglikelihood(varinfo),
lp=DynamicPPL.getlogjoint(varinfo),
logjoint=DynamicPPL.getlogjoint(varinfo),
),
)
end
Expand Down Expand Up @@ -158,7 +158,7 @@ function ParamsWithStats(
(
logprior=DynamicPPL.getlogprior(vi),
loglikelihood=DynamicPPL.getloglikelihood(vi),
lp=DynamicPPL.getlogjoint(vi),
logjoint=DynamicPPL.getlogjoint(vi),
),
)
end
Expand Down
8 changes: 4 additions & 4 deletions test/chains.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ using Test
@test length(ps.params) == 2
@test haskey(ps.stats, :logprior)
@test haskey(ps.stats, :loglikelihood)
@test haskey(ps.stats, :lp)
@test haskey(ps.stats, :logjoint)
@test length(ps.stats) == 3
@test ps.stats.lp ≈ ps.stats.logprior + ps.stats.loglikelihood
@test ps.stats.logjoint ≈ ps.stats.logprior + ps.stats.loglikelihood
@test ps.params[@varname(y)] ≈ ps.params[@varname(x)] + 1
@test ps.stats.logprior ≈ logpdf(Normal(), ps.params[@varname(x)])
@test ps.stats.loglikelihood ≈ logpdf(Normal(ps.params[@varname(y)]), z)
Expand All @@ -34,9 +34,9 @@ using Test
@test length(ps.params) == 1
@test haskey(ps.stats, :logprior)
@test haskey(ps.stats, :loglikelihood)
@test haskey(ps.stats, :lp)
@test haskey(ps.stats, :logjoint)
@test length(ps.stats) == 3
@test ps.stats.lp ≈ ps.stats.logprior + ps.stats.loglikelihood
@test ps.stats.logjoint ≈ ps.stats.logprior + ps.stats.loglikelihood
@test ps.stats.logprior ≈ logpdf(Normal(), ps.params[@varname(x)])
@test ps.stats.loglikelihood ≈ logpdf(Normal(ps.params[@varname(x)] + 1), z)
end
Expand Down
2 changes: 1 addition & 1 deletion test/ext/DynamicPPLMCMCChainsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using DynamicPPL, Distributions, MCMCChains, Test, AbstractMCMC
@test size(c, 1) == 50
@test size(c, 3) == 3
@test Set(c.name_map.parameters) == Set([:x, :y])
@test Set(c.name_map.internals) == Set([:logprior, :loglikelihood, :lp])
@test Set(c.name_map.internals) == Set([:logprior, :loglikelihood, :logjoint])
@test logpdf.(Normal(), c[:x]) ≈ c[:logprior]
@test c.info.varname_to_symbol[@varname(x)] == :x
@test c.info.varname_to_symbol[@varname(y)] == :y
Expand Down