tensorflow / tensorflow/probability
Avoid creating new computation nodes in `kernel_results` from MCMC kernels
Open
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
The one_step method of some MCMC kernels seem to return a kernel_result that contains new computation nodes.
If I run the following loop in graph mode, I would create new computation nodes in every iteration.
- boot strap and get "kernel result 0"
- Use "kernel result 0" to run the
one_stepmethod to get "kernel result 1" - Use "kernel result 1" to run the
one_stepmethod to get "kernel result 2"
...
How to avoid that?
return result_state, NUTSKernelResults(
next_.target_log_prob, next_.grads_target_log_prob,
leapfrogs_taken + new_leapfrogs,
leapfrogs_computed + tf.math.reduce_max(input_tensor=new_leapfrogs))
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 with tensorflow_probability/python/experimental/mcmc/nuts.py at the linked line, then trace how one_step constructs and returns NUTSKernelResults in graph mode. Reproduce the iterative loop and determine what behavior the existing MCMC tests establish; done means repeated one_step calls do not create new computation nodes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100