Closed
Description
Attempting to use a trace that was loaded from the text backend yields a KeyError, if the trace contains only a subset of the model's variables (e.g., if it was created using the trace=
argument to sample
).
Failing example:
with pm.Model() as model:
a = pm.Gamma('a', mu=10.0, sd=2.0)
b = pm.Gamma('b', mu=10.0, sd=2.0)
trace = pm.sample(trace=[model.a, model.a_log__])
assert len(trace.varnames) == 2
pm.backends.text.dump('trace.text', trace)
loaded = pm.backends.text.load('trace.text')
x = loaded[0] #!!! Will throw a KeyError looking for 'b_log__'