Constrain Parameters of an AutoGuide

Hi - I’m using an AutoGuide, specifically an AutoDelta guide, and am trying to constrain its parameters. In particular, I want the posterior mean for a particular latent variable to be positive.

In an earlier version of Pyro, one could apparently do this manually, prior to inference, by prepending inference with lines like below.

pyro.param("auto_concentration", torch.ones(k),

Is it still possible to constrain your AutoGuides parameters? Is it better to apply a function yourself with known range to the result of a sampling statement in your model, e.g. softplus or the exponential function?

i’m not entirely sure if i understand your question but when using AutoDelta the point estimate of each sample statement will be automatically constrained to the support of the corresponding prior distribution. so for example if the model contains pyro.sample("x", LogNormal(...)) then the MAP point estimate of x that you’ll be estimating when you use AutoDelta will necessarily be positive, since LogNormal has support on the positive real axis. so the usual way to provide constraints in this context would be to choose an appropriate prior distribution. does that address your question?

1 Like

Yes, thank you.