nutpie icon indicating copy to clipboard operation
nutpie copied to clipboard

store_unconstrained doesn't appear to do anything

Open daniel-s-tccc opened this issue 6 months ago • 3 comments

My understanding is that if you set it false, all the _log__ suffixed parameters shouldn't be returned in the trace. However, they linger:

import pymc as pm
import nutpie

with pm.Model() as model:
    a = pm.Exponential('a',scale=1)

compiled_model = nutpie.compile_pymc_model(model)
trace = nutpie.sample(compiled_model=compiled_model,store_unconstrained=False)

assert not hasattr(trace.posterior, 'a_log__')

Versions:

nutpie                    0.14.3          py311h533ab2d_0    conda-forge
pymc                      5.22.0               hd8ed1ab_0    conda-forge

daniel-s-tccc avatar May 27 '25 20:05 daniel-s-tccc

store_unconstrained controls if the unconstrained point is stored in trace.sampler_stats as a 1d vector. There is currently no way to control the unconstrainted values in trace.posterior. But maybe it should do that too? In that case it would do two different things though...

aseyboldt avatar May 27 '25 21:05 aseyboldt

store_unconstrained controls if the unconstrained point is stored in trace.sampler_stats as a 1d vector. There is currently no way to control the unconstrainted values in trace.posterior. But maybe it should do that too? In that case it would do two different things though...

Ahh that makes sense. Let's not make it do two different things. The cleaner fix is to just allow passing var_names like issue #100

daniel-s-tccc avatar May 27 '25 22:05 daniel-s-tccc

I also expected this behavior, and complained about it in #176 . Glad I'm not the only one :)

IMO the correct behavior is that nutpie should an unconstrained_posterior group in the returned InferenceData. This is suggeted by the arviz devs here. See #78

jessegrabowski avatar Jul 10 '25 01:07 jessegrabowski