Several keyword arguments in `nutpie.sample` appear to do nothing
~The following are listed in the docstring for sample but do not appear to be used anywhere:~
- ~num_try_init~
- ~store_divergences~
- ~store_unconstrained~
- ~store_gradient~
- ~store_mass_matrix~
- ~target_accept~
- ~maxdepth~
- ~use_grad_based_mass_matrix~
- ~mass_matrix_eigval_cutoff~
- ~mass_matrix_gamma~
Oh I get it, they're bundled into kwargs and put into settings. I was still having a problem with getting nutpie to respect store_unconstrained = False, so let me follow up in this issue and see if that's also me being dumb
Did you figure out what the problem with store_unconstrained was?
It just appears to not work? Can you confirm that sigma_log__ is in the posterior group of the idata if you run this code snippet?
import nutpie as ntp
import pymc as pm
with pm.Model() as model:
mu = pm.Normal("mu", mu=0, sigma=1)
sigma = pm.Gamma('sigma', alpha=2, beta=1)
obs = pm.Normal("obs", mu=mu, sigma=sigma, observed=[1, 2, 3])
ntp_mod = ntp.compile_pymc_model(model)
idata = ntp.sample(ntp_mod, store_unconstrained=False, progress_bar=False)
'sigma_log__' in idata.posterior # True
You might want to have a look at trace.sample_stats.unconstrained_position ;-)
But the unconstrained value is sigma_log__?
If store_unconstrained=True, it will store the parameter vector as one array in the sample stats. It doesn't change anything about trace.posterior, that will still contain only the constrained values. Maybe we should have an option to also store those as part of the posterior, but I'm not sure if that really is useful.
The parameter vector has a corresponding coordinate, so you can do trace.sample_stats.unconstrained_parameter.sel(unconstrained_parameter="sigma_log__").
I mostly like to use it to identify correlations and divergences, and for those I think it is a lot more convenient to have them in a 1d array: https://pymc-devs.github.io/nutpie/sample-stats.html#covariance-of-gradients-and-draws