Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of step_warmup #117

Merged
merged 42 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0987f5f
added step_warmup which is can be overloaded when convenient
torfjelde Mar 9, 2023
30c9f12
added step_warmup to docs
torfjelde Mar 9, 2023
7faa73f
Update src/interface.jl
torfjelde Mar 9, 2023
bd0bdc7
introduce new kwarg `num_warmup` to `sample` which uses `step_warmup`
torfjelde Mar 10, 2023
c620cca
updated docs
torfjelde Mar 10, 2023
572a286
allow combination of discard_initial and num_warmup
torfjelde Mar 10, 2023
6b842ee
added docstring for mcmcsample
torfjelde Mar 10, 2023
ca03832
Merge branch 'torfjelde/step-warmup' of github.com:TuringLang/Abstrac…
torfjelde Mar 10, 2023
0441773
Apply suggestions from code review
torfjelde Mar 10, 2023
ea369ff
Apply suggestions from code review
torfjelde Mar 10, 2023
8e0ca53
Update src/sample.jl
torfjelde Mar 10, 2023
6877978
removed docstring and deferred description of keyword arguments to th…
torfjelde Mar 10, 2023
b3b3148
Merge branch 'torfjelde/step-warmup' of github.com:TuringLang/Abstrac…
torfjelde Mar 10, 2023
ddc5254
Update src/sample.jl
torfjelde Mar 10, 2023
ffbd32f
Update src/sample.jl
torfjelde Mar 10, 2023
87480ff
added num_warmup to common keyword arguments docs
torfjelde Mar 10, 2023
76f2f23
also allow step_warmup for the initial step
torfjelde Mar 10, 2023
c00d0c9
Merge branch 'torfjelde/step-warmup' of github.com:TuringLang/Abstrac…
torfjelde Mar 10, 2023
ef09c19
simplify logic for discarding fffinitial samples
torfjelde Mar 10, 2023
49b8406
Apply suggestions from code review
torfjelde Mar 10, 2023
f005746
also report progress for the discarded samples
torfjelde Mar 10, 2023
9dccd8a
Merge branch 'torfjelde/step-warmup' of github.com:TuringLang/Abstrac…
torfjelde Mar 10, 2023
ff00e6e
Apply suggestions from code review
torfjelde Mar 10, 2023
7ce9f6b
move progress-report to end of for-loop for discard samples
torfjelde Mar 10, 2023
3a217b2
move step_warmup to the inner while loops too
torfjelde Mar 13, 2023
de9bb2c
Update src/sample.jl
torfjelde Mar 13, 2023
85d938f
Apply suggestions from code review
torfjelde Apr 19, 2023
0a667a4
reverted to for-loop
torfjelde Apr 19, 2023
91f5a10
Update src/sample.jl
torfjelde Apr 19, 2023
7603171
added accidentanly removed comment
torfjelde Apr 19, 2023
ef68d04
Update src/sample.jl
torfjelde Apr 19, 2023
25afc66
Merge branch 'master' into torfjelde/step-warmup
torfjelde Oct 24, 2023
1886fa8
Merge branch 'master' into torfjelde/step-warmup
torfjelde Oct 25, 2023
0ea293a
fixed formatting
torfjelde Oct 26, 2023
6e8f88e
fix typo
torfjelde Oct 26, 2023
44c55bb
Merge branch 'master' into torfjelde/step-warmup
torfjelde Oct 4, 2024
3b4f6db
Apply suggestions from code review
torfjelde Oct 4, 2024
f9142a6
Added testing of warmup steps
torfjelde Oct 4, 2024
295fdc1
Added checks as @devmotion requested
torfjelde Oct 4, 2024
e6acb1f
Removed unintended change in previous commit
torfjelde Oct 4, 2024
2e9fa5c
Bumped patch version
torfjelde Oct 4, 2024
366fceb
Bump minor version instead of patch version since this is a new feature
torfjelde Oct 4, 2024
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 = "4.4.0"
version = "4.4.1"

[deps]
BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"
Expand Down
13 changes: 13 additions & 0 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ current `state` of the sampler.
"""
function step end

"""
step_warmup(rng, model, sampler[, state; kwargs...])

Return a 2-tuple of the next sample and the next state of the MCMC `sampler` for `model`.

When sampling using [`sample`](@ref), this takes the place of [`step`](@ref) in the first `discard_initial`
number of iterations. This is useful if the sampler has a "warmup"-stage initial stage
that is different from the standard iteration.

By default, this simply calls [`step`](@ref.)
torfjelde marked this conversation as resolved.
Show resolved Hide resolved
"""
step_warmup(rng, model, sampler, state; kwargs...) = step(rng, model, sampler, state; kwargs...)
torfjelde marked this conversation as resolved.
Show resolved Hide resolved

"""
samples(sample, model, sampler[, N; kwargs...])

Expand Down
2 changes: 1 addition & 1 deletion src/sample.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function mcmcsample(
end

# Obtain the next sample and state.
sample, state = step(rng, model, sampler, state; kwargs...)
sample, state = step_warmup(rng, model, sampler, state; kwargs...)
end

# Run callback.
Expand Down