Skip to content

Commit

Permalink
Merge pull request #175 from tpapp/tp/change-stack-ordering
Browse files Browse the repository at this point in the history
change stacked ordering
  • Loading branch information
tpapp authored Dec 13, 2022
2 parents 9253328 + 2a123ca commit 5846bc4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DynamicHMC"
uuid = "bbc10e6e-7c05-544b-b16e-64fede858acb"
authors = ["Tamas K. Papp <[email protected]>"]
version = "3.4.1"
version = "3.4.2"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand All @@ -16,12 +16,16 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TensorCast = "02d47bb6-7ce6-556a-be16-bb1710789e2b"

[extras]
MCMCDiagnosticTools = "be115224-59cd-429b-ad48-344e309966f0"

[compat]
ArgCheck = "1, 2"
DocStringExtensions = "0.8, 0.9"
FillArrays = "0.13"
LogDensityProblems = "1, 2"
LogExpFunctions = "0.3"
MCMCDiagnosticTools = "0.2"
Parameters = "0.11, 0.12"
ProgressMeter = "1"
TensorCast = "0.4"
Expand Down
7 changes: 5 additions & 2 deletions src/mcmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -561,12 +561,15 @@ $(SIGNATURES)
Given a vector of `results`, each containing a property `posterior_matrix` (eg obtained from
[`mcmc_with_warmup`](@ref) with the same sample length), return a lazy view as an array
indexed by `[draw_index, parameter_index, chain_index]`.
indexed by `[draw_index, chain_index, parameter_index]`.
This is useful as an input for eg `MCMCDiagnosticTools.ess_rhat`.
!!! note
The ordering is not compatible with MCMCDiagnostictools version < 0.2.
"""
function stack_posterior_matrices(results)
@cast _[i, j, k]:= results[k].posterior_matrix[j, i]
@cast _[i, k, j]:= results[k].posterior_matrix[j, i]
end

"""
Expand Down
2 changes: 1 addition & 1 deletion test/test_mcmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ end
D, N, K = 5, 100, 7
= multivariate_normal(ones(5))
results = fill(mcmc_with_warmup(RNG, ℓ, N; reporter = NoProgressReport()), K)
@test size(stack_posterior_matrices(results)) == (N, D, K)
@test size(stack_posterior_matrices(results)) == (N, K, D)
@test size(pool_posterior_matrices(results)) == (D, N * K)
end

Expand Down

2 comments on commit 5846bc4

@tpapp
Copy link
Owner Author

@tpapp tpapp commented on 5846bc4 Dec 13, 2022

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/74043

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.4.2 -m "<description of version>" 5846bc459ac50bdbd499b103af79def0d90f804f
git push origin v3.4.2

Please sign in to comment.