Skip to content

Commit f108fe3

Browse files
Deprecate init_params which is no longer in AbstractMCMC (#353)
* 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>
1 parent 2239785 commit f108fe3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/abstractmcmc.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,15 @@ function AbstractMCMC.step(
103103
rng::AbstractRNG,
104104
model::LogDensityModel,
105105
spl::AbstractHMCSampler;
106-
init_params = nothing,
106+
initial_params = nothing,
107+
init_params = initial_params,
107108
kwargs...,
108109
)
110+
if init_params !== initial_params
111+
Base.depwarn("`init_params` is deprecated, use `initial_params` instead", :step)
112+
initial_params = init_params
113+
end
114+
109115
# Unpack model
110116
logdensity = model.logdensity
111117

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

118124
# Define integration algorithm
119125
# Find good eps if not provided one
120-
init_params = make_init_params(rng, spl, logdensity, init_params)
121-
ϵ = make_step_size(rng, spl, hamiltonian, init_params)
126+
initial_params = make_init_params(rng, spl, logdensity, initial_params)
127+
ϵ = make_step_size(rng, spl, hamiltonian, initial_params)
122128
integrator = make_integrator(spl, ϵ)
123129

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

130136
# Get an initial sample.
131-
h, t = AdvancedHMC.sample_init(rng, hamiltonian, init_params)
137+
h, t = AdvancedHMC.sample_init(rng, hamiltonian, initial_params)
132138

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

0 commit comments

Comments
 (0)