Currently, HSSM keeps a reference to the result of the last sampling. In #476, a bug was found that this internal InferenceData object does not get updated when InferenceData object already exists. This issue clarifies HSSM's behavior once the users resample:
Expected behavior
HSSM still keeps reference to the result of the last call to model.sample(). All results of the previous samples will be overwritten.
However, if there is an existing reference to a previous result, that reference will still be pointed to the result when the reference is created:
We expect that trace1 will still point to the first sample. Implicitly, if the user does not assign the result of the call to model.sample(), then the result of the previous call will be overwritten, and the InferenceData will be garbage collected.
If there is a new reference to the second model.sample() call, then we expect the samples to be different.
trace1 = model.sample(...)
trace2 = model.sample(...)
trace1 is trace2 #False
Any changes to the InferenceData object will directly change the object directly attached to the model (default Python behavior)
trace1 = model.sample(...)
trace2 = model.traces
trace1 is trace2 #True
del trace2["posterior_predictive"]
Then trace1 should not no longer have posterior_predictive group.
Describe the bug
Currently, HSSM keeps a reference to the result of the last sampling. In #476, a bug was found that this internal
InferenceData
object does not get updated whenInferenceData
object already exists. This issue clarifies HSSM's behavior once the users resample:Expected behavior
model.sample()
. All results of the previous samples will be overwritten.We expect that
trace1
will still point to the first sample. Implicitly, if the user does not assign the result of the call tomodel.sample()
, then the result of the previous call will be overwritten, and theInferenceData
will be garbage collected.If there is a new reference to the second
model.sample()
call, then we expect the samples to be different.InferenceData
object will directly change the object directly attached to the model (default Python behavior)Then
trace1
should not no longer haveposterior_predictive
group.