Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
keywords = ["markov chain monte carlo", "probablistic programming"]
license = "MIT"
desc = "A lightweight interface for common MCMC methods."
version = "3.0.1"
version = "3.0.2"

[deps]
BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ StatsBase.sample(
for regular and parallel sampling, respectively. In regular sampling, users may
provide a function
```julia
isdone(rng, model, sampler, samples, iteration; kwargs...)
isdone(rng, model, sampler, samples, state, iteration; kwargs...)
```
that returns `true` when sampling should end, and `false` otherwise, instead of
a fixed number of samples `nsamples`. AbstractMCMC defines the abstract types
Expand Down
2 changes: 1 addition & 1 deletion src/sample.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function mcmcsample(
# Step through the sampler until stopping.
i = 2

while !isdone(rng, model, sampler, samples, i; progress=progress, kwargs...)
while !isdone(rng, model, sampler, samples, state, i; progress=progress, kwargs...)
# Discard thinned samples.
for _ in 1:(thinning - 1)
# Obtain the next sample and state.
Expand Down
3 changes: 2 additions & 1 deletion test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ function isdone(
model::MyModel,
s::MySampler,
samples,
state,
iteration::Int;
kwargs...
)
# Calculate the mean of x.b.
bmean = mean(x.b for x in samples)
return abs(bmean) <= 0.001 || iteration >= 10_000
return abs(bmean) <= 0.001 || iteration >= 10_000 || state >= 10_000
end

# Set a default convergence function.
Expand Down