Closed kyleabeauchamp closed 8 years ago
>>> pm.geometric_like(0.1, rho)
-1.7976931348623157e+308
This is related to the initial value, which is chosen here as a random draw from a geometric with parameter rho
. These values can be quite large:
In [13]: x = pm.rgeometric(rho, size=10000)
In [14]: x
Out[14]:
array([ 504360309, 241731401, 416182498, ..., 1833893834, 22033398,
8510115])
In [15]: x.max()
Out[15]: 8509440316
If you pass this as a value to the geometric, you get an overflow:
In [17]: pm.geometric_like(x.max(), rho)
Out[17]: -1.7976931348623157e+308
Sounds plausible to me: the logprob overflows before the random draws so extra care is needed near the boundaries of the feasible parameters.
I can use 64-bit integers, which should fix it.
So I find that for small values of
rho
, the geometric RV can cause an exception. I understand that this is expected for rho=0. However, what surprised me was that for rho=1E-9, the random variable will actually fail to initialize stochastically. E.g. the variable creation will cause the following error 10% of the time.Do you find this failure mode surprising or expected?