Skip to content

Commit e79e7b9

Browse files
committed
add optional argument of logdensity_function
1 parent 467b076 commit e79e7b9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/AbstractMCMC.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,27 @@ The `MCMCSerial` algorithm allows users to sample serially, with no thread or pr
8181
struct MCMCSerial <: AbstractMCMCEnsemble end
8282

8383
"""
84-
getparams(state[; kwargs...])
84+
getparams(state[, logdensity_function])
8585
8686
Retrieve the values of parameters from the sampler's `state` as a `Vector{<:Real}`.
8787
"""
8888
function getparams end
8989

9090
"""
91-
setparams!!(state, params)
91+
setparams!!(state, params[, logdensity_function])
9292
9393
Set the values of parameters in the sampler's `state` from a `Vector{<:Real}`.
9494
9595
This function should follow the `BangBang` interface: mutate `state` in-place if possible and
9696
return the mutated `state`. Otherwise, it should return a new `state` containing the updated parameters.
9797
98-
Although not enforced, it should hold that `setparams!!(state, getparams(state)) == state`. In another
99-
word, the sampler should implement a consistent transformation between its internal representation
98+
Although not enforced, it should hold that `setparams!!(state, getparams(state)) == state`. In other
99+
words, the sampler should implement a consistent transformation between its internal representation
100100
and the vector representation of the parameter values.
101+
102+
Sometimes, to maintain the consistency of the log density and parameter values, an optional
103+
`logdensity_function` can be provided. This is useful for samplers that need to evaluate the
104+
log density at the new parameter values.
101105
"""
102106
function setparams!! end
103107

0 commit comments

Comments
 (0)