I’m trying to model the distribution of dust in galaxies. At any given point, the distribution is LogNormal, but I’m trying to use a GP prior on the mu, sigma of the underlying Normal distribution to capture the spatial information between different positions. Now, since these have very different expected properties, I’m trying to use a different GP for each parameter, but with a shared length scale. When I include the HSGP over mu, this works without a problem. However, when I try to add a second over log(sigma), an error is raised. This appears to be because both HSGPs use “beta” for the basis function site names. How can I get around this? I attempted to block
the GPs, but this didn’t seem to work. And advice would be most appreciated!
As an aside, the model is also using discrete latents. When I attempt to infer the non-discrete parameters, I get tracer leaks that I can’t seem to eliminate. The model has a lot of parameters, so I’m using SVI with TraceEnum_ELBO and blocking the discrete sites.
I noticed the PR Use functional interface funsor.adjoint.adjoint to avoid tracer leak by fehiepsi · Pull Request #2002 · pyro-ppl/numpyro · GitHub - is it reasonable to think this is the cause? If so, is there any sort of workaround I can use in the meantime?
I think you can solve the naming using scope as in numpyro/test/contrib/hsgp/test_approximation.py at master · pyro-ppl/numpyro · GitHub
1 Like
Oh, that’s very handy, thanks! So something like:
def model(args):
# ... model set up
some_site = numpyro.sample(...)
with scope(prefix='gp1'):
gp1 = hsgp_matern(x=args['data']['x'], nu=1.5, length=length, alpha=alpha, ell=ell, m=m)
with scope(prefix='gp2'):
gp2 = hsgp_matern(x=args['data']['x'], nu=1.5, length=length, alpha=alpha, ell=ell, m=m)
# ... rest of model ...
? Or did I overlook something?