tensorflow / tensorflow/probability
Awkward thinning/burn-in semantics for `sample_chain`
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Currently, sample_chain implements thinning and burn-in as follows:
- the first sample will step the inner kernel
num_burnin_steps+ 1 times - any other samples will step
num_steps_between_results+ 1 times
This runs into the issue of never accomplishing thinning with repeated calls to the driver with num_steps=1. To illustrate, consider the toy example:
current_state = 0
for _ in range(5):
new_sample, _ = sample_chain(
num_steps=1,
current_state=current_state,
kernel=<some_kernel>,
num_burnin_steps=0,
num_steps_between_results=100)
current_state = do_something(new_sample)
At every iteration, the first sample drawn from the kernel is returned from sample_chain, though one should expect some thinning. The workaround would be doing everything manually from kernel.one_step calls, but that kind of defeats the purpose of having a smart driver in the first place.
It seems more natural to have semantics as follows:
- the first sample will step the inner kernel
num_burnin_steps+num_steps_between_results+ 1 times - any other samples will step
num_steps_between_results+ 1 times
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the sample_chain entry point and reproduce the repeated num_steps=1 example with num_steps_between_results=100. Done means the first returned sample includes burn-in plus thinning steps, while subsequent samples retain the stated thinning interval.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- tensorflow
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100