multiply_log(0, 0) has infinite gradient
Open
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Description
For more details, see https://discourse.mc-stan.org/t/non-linear-modelling-michaelis-menten/22736/8
Example
The gradient for poisson_lpmf(0 | lambda) is infinite at lambda = 0.
Suggested fix
@nhuurre writes on discourse:
We should just special-case a=0.0 like we do with a=1.0
Current Version:
v4.0.1
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 by reviewing the multiply_log implementation and its existing special case for a=1.0. Check the linked discussion and pull request for the proposed scope, then run the relevant gradient tests. Done means poisson_lpmf(0 | lambda) no longer has an infinite gradient at lambda=0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100