I am working through the following example code on multilevel models:
When running exactly the same code locally for the model with covariations (covariation_intercept_slope) and then running plot_trace,I am getting the following error:
“cannot convert float infinity to integer”
Can you please advise how to fix this? I am confused since I did not do any changes to the example code and yet I cannot run it and cannot figure out why (did google the error but did not manage to find a way how to apply any fixes to the model or inference data object)
I am using pymc3 version 3.11.2
What line/cell is generating the error?
Hi, here is a screenshot of the error:
It’s running ok for me here on 3.11.2. The error suggest that some of the sampled values are infinite (which is obviously a bad sign) and arviz doesn’t know what to plot. Not sure where things could be getting off track. What messages are you seeing after sampling is complete (e.g., after the previous cell)?
As @cluhmann I suspect the model has not converged somehow and there are some draws whose value is infinity (represented in
np.inf). This is not considered nor supported in the KDE function that errors out when trying to generate the KDE with infinite bandwidth.
You should be able to confirm there are samples with infinity value using
Or there might also be a warning during or after sampling as @cluhmann suggests, not sure about that.
after the sampling, I see the following messages:
Thank you for your explanation, I roughly understand what the problem is, I was just wondering why I am not able to replicate this particular example. All the previous models up to the one with covariation ran just fine.
Is there any chance you know about a different example of a similar model including covariation?