After encountering an odd problem with cv_MRF_diag with Poisson data, I found a simple solution (with the help of @hezibu). The problem I had was that NaNs were produced when dividing zero by zero while creating preds_log. Other numbers divided by zero were taken care of with is.infinite but NaNs weren't.
I used the same procedure already implemented in the function, to set infinite values to zero (when numbers were divided by 0), but with is.nan instead if is.infinite.
Here is my suggested fix [my additions in rows 299 and 324:
After encountering an odd problem with
cv_MRF_diag
with Poisson data, I found a simple solution (with the help of @hezibu). The problem I had was that NaNs were produced when dividing zero by zero while creatingpreds_log
. Other numbers divided by zero were taken care of withis.infinite
but NaNs weren't. I used the same procedure already implemented in the function, to set infinite values to zero (when numbers were divided by 0), but withis.nan
instead ifis.infinite
.Here is my suggested fix [my additions in rows 299 and 324:
Does this look adequate?