Closed rusty-robin closed 2 years ago
Hi @rusty-robin this typically happens when you have constant samples. Looking like with the default strategy, we start MCMC at the tail of student t prior, hence the geometry there will be tricky to guide the HMC sampler. You can try different initial strategies like init_to_sample
but even so, working with large value is not robust. You might want to call numpyro.enable_x64()
at the beginning of your program to help the inference a bit.
Thanks for the response @fehiepsi
I see. What do you mean by constant samples here? The data points: x and y?
It seems there should better error messages here? Otherwise, there is no way to guide the user. Ideally, the statistics should also not be NaNs i feel.
I will be happy to contribute if you have any suggestions on addressing these points.
I just looked at your b
sigma
and w
std values.
It seems there should better error messages here? Otherwise, there is no way to guide the user. Ideally, the statistics should also not be NaNs i feel.
I'm not sure if we need to raise error messages here. Sometimes we just got constant samples (e.g. when drawing discrete latent values). Those r_hat, n_eff diagnostics can produce nan
- but I'm not sure if getting constant samples are good or bad. How about adding a not to docstring of print_summary
to mention that nan/inf
might indicate that the variance of your samples is very small.
Closed because the behavior is expected. Please feel free to open a PR that enhances the documentation to mention it.
Hi,
I am testing some models with NumPyro and trying out various combinations to evaluate performance of MCMC algorithms. I observed that running a linear regression model with NumPyro causes the
Rhat
andNeff
values to beNaN
for some parameters.I think this happens when the distribution parameters are large (e.g. for studentT, its of the order 10^31). If I change those then I dont see NaN values. However, are the NaNs expected in this case or should there be better handling for such extreme values?
Let me know what you guys think.
Code:
Output:
Environment: