Hello there! I’m quite new to PyMC, so please forgive me for the rather elementary question.
I’m trying to perform HMC sampling on a simple test distribution (which conceptually only requires me to specify a scaling matrix, a starting point, and the distribution itself, plus some other parameters like step size). I’m trying to achieve this in PyMC, but the documentation for the HamiltonianMC step method requires that it be run on a model with free Random Variables. So far I’ve tried to define the logp function, call
pm.Potential on it, and nest it in a Model as shown below:
import aesara import aesara.tensor as at def testlogp(x, y): return -x*x*x*x/8 + y*x*x - 2*y*y - x*x/4 with pm.Model() as model: x = at.scalar('x') y = at.scalar('y') z = pm.Potential('test', testlogp(x, y))
I was hoping that, with this model defined, I could just call
pm.sample with the step method set to HMC with variables
y so I could obtain HMC samples of (x, y) according to
testlogp. But clearly the model doesn’t have any free RVs. Is there any workaround to this?