From 7bb392949ecfcbb15f6f68b4c6c4617001c90eb5 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 24 Oct 2025 13:44:58 +0100 Subject: [PATCH 1/2] Add `getstats` --- Project.toml | 2 +- src/AbstractMCMC.jl | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index cc7d8b8d..7c40ca91 100644 --- a/Project.toml +++ b/Project.toml @@ -3,7 +3,7 @@ uuid = "80f14c24-f653-4e6a-9b94-39d6b0f70001" keywords = ["markov chain monte carlo", "probabilistic programming"] license = "MIT" desc = "A lightweight interface for common MCMC methods." -version = "5.8.2" +version = "5.9.0" [deps] BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66" diff --git a/src/AbstractMCMC.jl b/src/AbstractMCMC.jl index e103d5a5..61f15480 100644 --- a/src/AbstractMCMC.jl +++ b/src/AbstractMCMC.jl @@ -116,6 +116,13 @@ function getparams(model::AbstractModel, state) return getparams(state) end +""" + getstats(state) + +Retrieve sampler statistics from the sampler's `state` as a `NamedTuple`. +""" +function getstats end + """ setparams!!([model::AbstractModel, ]state, params) From 960b09977fc99edf98b998814aaa42e5ce6404ed Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 24 Oct 2025 13:55:41 +0100 Subject: [PATCH 2/2] Add requires_unconstrained_space as well --- src/AbstractMCMC.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/AbstractMCMC.jl b/src/AbstractMCMC.jl index 61f15480..185082a3 100644 --- a/src/AbstractMCMC.jl +++ b/src/AbstractMCMC.jl @@ -106,7 +106,14 @@ See also [`sample`](@ref). struct MCMCSerial <: AbstractMCMCEnsemble end """ - getparams([model::AbstractModel, ]state) + requires_unconstrained_space(sampler::AbstractSampler)::Bool + +Return `true` if the given sampler must run in unconstrained space. Defaults to true. +""" +requires_unconstrained_space(::AbstractSampler) = true + +""" + getparams([model::AbstractModel, ]state)::Vector{<:Real} Retrieve the values of parameters from the sampler's `state` as a `Vector{<:Real}`. """ @@ -117,7 +124,7 @@ function getparams(model::AbstractModel, state) end """ - getstats(state) + getstats(state)::NamedTuple Retrieve sampler statistics from the sampler's `state` as a `NamedTuple`. """