Skip to content

Commit 0a0853d

Browse files
Rename init_params keyword argument to initial_params (#33)
* Rename `init_params` keyword argument to `initial_params` * Apply suggestions from code review 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 ca4babb commit 0a0853d

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "EllipticalSliceSampling"
22
uuid = "cad2338a-1db2-11e9-3401-43bc07c9ede2"
33
authors = ["David Widmann <david.widmann@it.uu.se>"]
4-
version = "1.1.0"
4+
version = "2.0.0"
55

66
[deps]
77
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
@@ -11,7 +11,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1111
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1212

1313
[compat]
14-
AbstractMCMC = "3.2, 4"
14+
AbstractMCMC = "5"
1515
ArrayInterface = "7"
1616
Distributions = "0.22, 0.23, 0.24, 0.25"
1717
julia = "1.6"

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ AbstractMCMC.steps(
5555
gives you access to an iterator from which you can generate an unlimited
5656
number of samples.
5757

58-
You can define the starting point of your chain using the `init_params` keyword argument.
58+
You can define the starting point of your chain using the `initial_params` keyword argument.
5959

6060
For more details regarding `sample` and `steps` please check the documentation of
6161
[AbstractMCMC.jl](https://github.com/TuringLang/AbstractMCMC.jl).

src/abstractmcmc.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ function AbstractMCMC.step(
2222
rng::Random.AbstractRNG,
2323
model::AbstractMCMC.AbstractModel,
2424
::ESS;
25-
init_params=nothing,
25+
initial_params=nothing,
2626
kwargs...,
2727
)
2828
# initial sample from the Gaussian prior
29-
f = init_params === nothing ? initial_sample(rng, model) : init_params
29+
f = initial_params === nothing ? initial_sample(rng, model) : initial_params
3030

3131
# compute log-likelihood of the initial sample
3232
loglikelihood = Distributions.loglikelihood(model, f)

test/simple.jl

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@
3737
# initial parameter
3838
init_x = randn(5)
3939
samples = sample(
40-
ESSModel(prior, ℓ), ESS(), alg, 10, 5; progress=false, init_params=init_x
40+
ESSModel(prior, ℓ), ESS(), alg, 10, 5; progress=false, initial_params=init_x
4141
)
4242
@test map(first, samples) == init_x
4343
end
4444

4545
# initial parameter
4646
init_x = randn()
47-
samples = sample(ESSModel(prior, ℓ), ESS(), 10; progress=false, init_params=init_x)
47+
samples = sample(
48+
ESSModel(prior, ℓ), ESS(), 10; progress=false, initial_params=init_x
49+
)
4850
@test first(samples) == init_x
4951
end
5052

@@ -77,14 +79,16 @@
7779
# initial parameter
7880
init_x = randn(5)
7981
samples = sample(
80-
ESSModel(prior, ℓ), ESS(), alg, 10, 5; progress=false, init_params=init_x
82+
ESSModel(prior, ℓ), ESS(), alg, 10, 5; progress=false, initial_params=init_x
8183
)
8284
@test map(first, samples) == init_x
8385
end
8486

8587
# initial parameter
8688
init_x = randn()
87-
samples = sample(ESSModel(prior, ℓ), ESS(), 10; progress=false, init_params=init_x)
89+
samples = sample(
90+
ESSModel(prior, ℓ), ESS(), 10; progress=false, initial_params=init_x
91+
)
8892
@test first(samples) == init_x
8993
end
9094

@@ -118,15 +122,21 @@
118122
# initial parameter
119123
init_x = [randn(1) for _ in 1:5]
120124
samples = sample(
121-
ESSModel(prior, ℓvec), ESS(), alg, 10, 5; progress=false, init_params=init_x
125+
ESSModel(prior, ℓvec),
126+
ESS(),
127+
alg,
128+
10,
129+
5;
130+
progress=false,
131+
initial_params=init_x,
122132
)
123133
@test map(first, samples) == init_x
124134
end
125135

126136
# initial parameter
127137
init_x = randn(1)
128138
samples = sample(
129-
ESSModel(prior, ℓvec), ESS(), 10; progress=false, init_params=init_x
139+
ESSModel(prior, ℓvec), ESS(), 10; progress=false, initial_params=init_x
130140
)
131141
@test first(samples) == init_x
132142
end
@@ -161,15 +171,21 @@
161171
# initial parameter
162172
init_x = [randn(1) for _ in 1:5]
163173
samples = sample(
164-
ESSModel(prior, ℓvec), ESS(), alg, 10, 5; progress=false, init_params=init_x
174+
ESSModel(prior, ℓvec),
175+
ESS(),
176+
alg,
177+
10,
178+
5;
179+
progress=false,
180+
initial_params=init_x,
165181
)
166182
@test map(first, samples) == init_x
167183
end
168184

169185
# initial parameter
170186
init_x = randn(1)
171187
samples = sample(
172-
ESSModel(prior, ℓvec), ESS(), 10; progress=false, init_params=init_x
188+
ESSModel(prior, ℓvec), ESS(), 10; progress=false, initial_params=init_x
173189
)
174190
@test first(samples) == init_x
175191
end

0 commit comments

Comments
 (0)