tensorflow / tensorflow/probability
Possible error in `tfp.mcmc.HamiltonianMonteCarlo` API documentation
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 first example given in the API documentation for tfp.mcmc.HamiltonianMonteCarlo is sampling from the "standard univariate normal distribution", but I think that the target_log_prob_fn argument supplied in that example is for some other probability distribution?
# Target distribution is proportional to: `exp(-x (1 + x))`.
def unnormalized_log_prob(x):
return -x - x**2.
Running the example code unmodified returns the following result:
mean:-0.4927 stddev:0.6951 acceptance:0.6480
Modifying the example code so that unnormalized_log_prob corresponds to the standard normal distribution (i.e. a univariate normal distribution with μ=0 and σ=1) returns the following results:
# Target distribution is proportional to: `exp(-(x**2)/2)`.
def unnormalized_log_prob(x):
return -0.5*x**2
mean:0.0306 stddev:0.9846 acceptance:0.5537
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 the first example on the linked HamiltonianMonteCarlo API documentation page and compare its stated standard normal target with the supplied unnormalized_log_prob function. Done means the example's description, function, and demonstrated output consistently represent a standard univariate normal distribution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation, machine-learning
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100