Sampling from dataset

I am fitting my posterior trace with a scipy fit function, and storing the values for later use. This way I avoid storing the whole trace. If I come across a weird distribution, that cannot be fitted directly by scipy, is there a way to store the whole trace, and use this in another sampling? something like:

with pm.Model() as model:
    previousTrace = pm.Data("data", previousTraceList)
    norm = pm.Normal("norm", mu=0, sd=1)
    det = pm.Deterministic("det", norm + previousTrace)
    pm.sample()

so that the “det” variable will now sample from previousTrace and norm, and treat previousTrace as a variable part of the model.

no way to do this?

Maybe you can take a look at ArviZ’s to and from_netcdf functions?

1 Like