You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking back on issue #6 - I spent time trying to track down why my SIS model wasn't doing what I thought, and it turned out to be overflow of the uint8 datatype.
So closing that issue, because it is solved/never a bug, but I'm wondering whether we want to implement some checking to prevent this issue downstream.
Unfortunately, numpy won't do this for us - numpy should raise overflow errors for scalar variables, but the team has decided not to implement overflow checking for numpy integer arrays.
"Unlike true floating point errors (where the hardware FPU sets a flag whenever it does an atomic operation that overflows), we need to implement the integer overflow detection ourselves. We do it on the scalars, but not arrays because it would be too slow to implement for every atomic operation on arrays." link
Interesting to me though, is that the overflow was happening in this line: itimers[i] = np.maximum(np.uint8(1), np.uint8(np.ceil(np.random.exponential(inf_mean)))) I feel like an error should have been raised at the casting point np.uint8(np.ceil(np.random.exponential(inf_mean))), but wasn't.
Either way, would be good to have some checking eventually, as this was a bit of an annoying rabbit hole. Checking probably made easier by first addressing #8
The text was updated successfully, but these errors were encountered:
Looking back on issue #6 - I spent time trying to track down why my SIS model wasn't doing what I thought, and it turned out to be overflow of the uint8 datatype.
So closing that issue, because it is solved/never a bug, but I'm wondering whether we want to implement some checking to prevent this issue downstream.
Unfortunately, numpy won't do this for us - numpy should raise overflow errors for scalar variables, but the team has decided not to implement overflow checking for numpy integer arrays.
"Unlike true floating point errors (where the hardware FPU sets a flag whenever it does an atomic operation that overflows), we need to implement the integer overflow detection ourselves. We do it on the scalars, but not arrays because it would be too slow to implement for every atomic operation on arrays." link
Interesting to me though, is that the overflow was happening in this line:
itimers[i] = np.maximum(np.uint8(1), np.uint8(np.ceil(np.random.exponential(inf_mean))))
I feel like an error should have been raised at the casting pointnp.uint8(np.ceil(np.random.exponential(inf_mean)))
, but wasn't.Either way, would be good to have some checking eventually, as this was a bit of an annoying rabbit hole. Checking probably made easier by first addressing #8
The text was updated successfully, but these errors were encountered: