While using pm.sample(…, init=“advi+adapt_diag”) I encountered convergence problems in the advi estimation similar to this post: Convergence problems with ADVI
Using advi.fit(…, obj_optimizer=pm.adadelta()) solves the convergence issues, but since I need NUTS due to a complicated posterior, my question is:
How can I take the output of this advi.fit() and use it as initvals in pm.sample?
Alternatively, how can I specify the obj_optimizer of the init method “advi+adapt_diag” in pm.sample?
You can pass a dictionary of initial values to pm.sample
, via the kwarg initvals
, which you can populate with the results of advi.fit()
. Is your question how to do this exactly?
Also, you may want to then choose an init method without jittering, so that sampling starts exactly at those initvals.
Yes exactly, my question is how can I turn the advi.fit() output into a dictionary that I can use in that way.
From my understanding, providing initvals will override the init argument. I will in any case remove the init argument when using initvals.
It seems I was mistaken about how initvals work:
Apparently initvals are used to initialize the “init” method in pymc.sample(), and not to initialize the HMC directly as an alternative to “init”, (which I thought).
My question should then be:
When using pymc.sample with init=“advi+adapt_diag”, is there a way to change the obj_optimizer in the advi?