As part of a new MCMC method I have written for PyMC3, I need to find a way to pass input arguments to the theano likelihood function which do not belong to the set of random variables sampled by the method.
The way I am trying to do it is by writing a different version of
pymc3/pymc3/step_methods/metropolis.py (see here).
I want to be able to call the delta likelihood within an MCMC
astep() like this:
delta_logp(q, q0, a1, a2) (instead of the current
delta_logp(q, q0) used in Metropolis and other methods), where
q0 are the proposed and current samples of the chain and
a2 are the extra arguments.
These extra arguments are quantities updated in each iteration by the MCMC algorithm (using info from various chains) and they are used to correct the bias of the likelihood (which is an approximate version of the “correct” one). The quantities They are not random variables and are not part of the model.
Has anyone tried doing this or is there a relevant example somewhere? I have been struggling with the Theano/PyMC3 interface. The function
join_nonshared_inputs() (see here) which is used within
delta_logp() packs shared variables in the input theano vector but I do not know how to make it include non-random variable to the same input theano vector.