Skip to content

Commit

Permalink
Deprecate init_params which is no longer in AbstractMCMC (#353)
Browse files Browse the repository at this point in the history
* deprecate init_params keyword in favour of initial_params

* Update src/abstractmcmc.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
torfjelde and github-actions[bot] authored Oct 27, 2023
1 parent 2239785 commit f108fe3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/abstractmcmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,15 @@ function AbstractMCMC.step(
rng::AbstractRNG,
model::LogDensityModel,
spl::AbstractHMCSampler;
init_params = nothing,
initial_params = nothing,
init_params = initial_params,
kwargs...,
)
if init_params !== initial_params
Base.depwarn("`init_params` is deprecated, use `initial_params` instead", :step)
initial_params = init_params
end

# Unpack model
logdensity = model.logdensity

Expand All @@ -117,8 +123,8 @@ function AbstractMCMC.step(

# Define integration algorithm
# Find good eps if not provided one
init_params = make_init_params(rng, spl, logdensity, init_params)
ϵ = make_step_size(rng, spl, hamiltonian, init_params)
initial_params = make_init_params(rng, spl, logdensity, initial_params)
ϵ = make_step_size(rng, spl, hamiltonian, initial_params)
integrator = make_integrator(spl, ϵ)

# Make kernel
Expand All @@ -128,7 +134,7 @@ function AbstractMCMC.step(
adaptor = make_adaptor(spl, metric, integrator)

# Get an initial sample.
h, t = AdvancedHMC.sample_init(rng, hamiltonian, init_params)
h, t = AdvancedHMC.sample_init(rng, hamiltonian, initial_params)

# Compute next transition and state.
state = HMCState(0, t, metric, κ, adaptor)
Expand Down

0 comments on commit f108fe3

Please sign in to comment.