Adding constraints to autoguides

Hi,

I am attempting to use the an AutoDelta guide for my model. It works well, whereas my custom guide was seeing volatile loss, so I am hoping to implement it. However, I need to add constraints as part of the guide. I attempted to replace this section of code:

site_loc = numpyro.param("{}_{}_loc".format(name, self.prefix), init_loc,
constraint=site[‘fn’].support,
event_dim=event_dim)

with this:

site_loc = numpyro.param("{}_{}_loc".format(name, self.prefix), init_loc,
constraint=dist.constraint.interval(lower_bound = [my bounds], upper_bound = [my bounds]),
event_dim=event_dim)

However, this is returning NaN loss and parameters. The bounds I have used are working inside my custom guide (returning values for loss and params, although as I mentioned not consistent ones).

Is it possible to apply custom constraints to the autoguide classes?

Thanks in advance!

However, this is returning NaN loss and parameters.

@tjm Probably init_loc is outside of the interval?

Is it possible to apply custom constraints to the autoguide classes?

I think it is better to use a custom guide or rewrite the model using truncated distributions or transformed distributions (so that the support of your distribution belongs to your desired domain). Alternatively, in your model, you might use an improper distribution

class ImproperNormal(Normal):
    support = constraints.greater_than(10.)