From e79e7b9b0774607a83aec2996529fe5f9744d27f Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Wed, 23 Oct 2024 20:13:33 +0100 Subject: [PATCH] add optional argument of logdensity_function --- src/AbstractMCMC.jl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/AbstractMCMC.jl b/src/AbstractMCMC.jl index 8343bfa..dac49db 100644 --- a/src/AbstractMCMC.jl +++ b/src/AbstractMCMC.jl @@ -81,23 +81,27 @@ The `MCMCSerial` algorithm allows users to sample serially, with no thread or pr struct MCMCSerial <: AbstractMCMCEnsemble end """ - getparams(state[; kwargs...]) + getparams(state[, logdensity_function]) Retrieve the values of parameters from the sampler's `state` as a `Vector{<:Real}`. """ function getparams end """ - setparams!!(state, params) + setparams!!(state, params[, logdensity_function]) Set the values of parameters in the sampler's `state` from a `Vector{<:Real}`. This function should follow the `BangBang` interface: mutate `state` in-place if possible and return the mutated `state`. Otherwise, it should return a new `state` containing the updated parameters. -Although not enforced, it should hold that `setparams!!(state, getparams(state)) == state`. In another -word, the sampler should implement a consistent transformation between its internal representation +Although not enforced, it should hold that `setparams!!(state, getparams(state)) == state`. In other +words, the sampler should implement a consistent transformation between its internal representation and the vector representation of the parameter values. + +Sometimes, to maintain the consistency of the log density and parameter values, an optional +`logdensity_function` can be provided. This is useful for samplers that need to evaluate the +log density at the new parameter values. """ function setparams!! end