I’m trying to figure out how to initialize parameters of the variational approximation from a previous run.
For example, I first run the following:
with model:
group1 = pm.variational.opvi.Group([model.vars[0]], vfam='mean_field')
group2 = pm.variational.opvi.Group([model.vars[1]], vfam='scale-hh*20-loc')
group3 = pm.variational.opvi.Group([model.vars[2]], vfam='scale-hh*20-loc')
approx = pm.variational.opvi.Approximation([group1, group2, group3])
fit = pm.KLqp(approx).fit(n=10000, obj_optimizer=pm.adam(learning_rate=2e-03))
I then want to start another run with the best values from the previous run. I looked at the docs but I couldn’t find anything. The following doesn’t seem to work:
with model:
group1 = pm.variational.opvi.Group([model.vars[0]], params=approx.groups[0].params_dict)
group2 = pm.variational.opvi.Group([model.vars[1], params=approx.groups[1].params_dict)
group3 = pm.variational.opvi.Group([model.vars[2], params=approx.groups[2].params_dict)
approx2 = pm.variational.opvi.Approximation([group1, group2, group3])
fit2 = pm.KLqp(approx2).fit(n=10000, obj_optimizer=pm.adam(learning_rate=2e-03))