Bound of a sum of variables

If I want to set a bound on a sum of variables, is my best bet to use pm.Potential?

In this example, adding a pm.Potential makes one of the chains go haywire. I suspect, though, it’s because I’ve set the sum of the true values to be very close to the point where the potential “kicks in,” because when I set the threshold so high as to be irrelevant, the problem goes away.

Should I try a smoother function for my bound so it’s not a step function? Any other best practices for this?
Thanks in advance.

I think a harder bound condition should help: bound = pm.Potential('bound', T.switch([0] + rho[1], 1.0), -np.inf, 0.0))
However, you might still have divergent issue tho, as samples could goes out of bound.

1 Like