Skip to content

Commit

Permalink
add optional argument of logdensity_function
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 committed Oct 23, 2024
1 parent 467b076 commit e79e7b9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/AbstractMCMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e79e7b9

Please sign in to comment.