OverflowError: math range error

when I used hmc sampling, there is OverflowError: math range error. However, when I used metropolis sampling,there is no error.

why?

step=pm.HamiltonianMC()

Yeah that’s a bug.
should replace math.exp with np.exp. Do you want to send a PR to fix this?

en, I hadn’t use max.exp.

Oh, I see. PR, pull requests.

PR means pull request - if you found a bug in the code, and you know how to fix it, you can send a pull request on Github, there is more information here:

The error you are seeing is a bug in PyMC3, where hmc uses math.exp to compute the exponential and math.exp gives an error if the input is too large. Replacing math.exp with np.exp would fix this.

Oh, I see. Thanks! I will have a try.

1 Like