Create object to adapt proposal scale to coerce average acceptance rate.
Source:R/adaptation.R
scale_adapter.Rd
Create object to adapt proposal scale to coerce average acceptance rate.
Arguments
- proposal
Proposal object to adapt. Must define an
update
function which accepts a parameterscale
for setting scale parameter of proposal.- initial_scale
Initial value to use for scale parameter.
- target_accept_prob
Target value for average accept probability for chain.
- kappa
Decay rate exponent in
[0.5, 1]
for adaptation learning rate.
Value
List of functions with entries
initialize
, a function for initializing adapter state at beginning of chain,update
a function for updating adapter state and proposal parameters on each chain iteration,finalize
a function for performing any final updates to adapter state and proposal parameters on completion of chain sampling (may beNULL
if unused).
Examples
target_distribution <- list(
log_density = function(x) -sum(x^2) / 2,
grad_log_density = function(x) -x
)
proposal <- barker_proposal(target_distribution)
adapter <- scale_adapter(
proposal,
initial_scale = 1., target_accept_prob = 0.4
)