Skip to content

Commit e58f735

Browse files
authored
Add AbstractMCMC.getstats and AbstractMCMC.requires_unconstrained_space (#182)
* Add `getstats` * Add requires_unconstrained_space as well
1 parent e4305cb commit e58f735

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uuid = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
33
keywords = ["markov chain monte carlo", "probabilistic programming"]
44
license = "MIT"
55
desc = "A lightweight interface for common MCMC methods."
6-
version = "5.8.2"
6+
version = "5.9.0"
77

88
[deps]
99
BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"

src/AbstractMCMC.jl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,14 @@ See also [`sample`](@ref).
106106
struct MCMCSerial <: AbstractMCMCEnsemble end
107107

108108
"""
109-
getparams([model::AbstractModel, ]state)
109+
requires_unconstrained_space(sampler::AbstractSampler)::Bool
110+
111+
Return `true` if the given sampler must run in unconstrained space. Defaults to true.
112+
"""
113+
requires_unconstrained_space(::AbstractSampler) = true
114+
115+
"""
116+
getparams([model::AbstractModel, ]state)::Vector{<:Real}
110117
111118
Retrieve the values of parameters from the sampler's `state` as a `Vector{<:Real}`.
112119
"""
@@ -116,6 +123,13 @@ function getparams(model::AbstractModel, state)
116123
return getparams(state)
117124
end
118125

126+
"""
127+
getstats(state)::NamedTuple
128+
129+
Retrieve sampler statistics from the sampler's `state` as a `NamedTuple`.
130+
"""
131+
function getstats end
132+
119133
"""
120134
setparams!!([model::AbstractModel, ]state, params)
121135

0 commit comments

Comments
 (0)