1

What distribution is being used under the hood of PyMC's Uninformative prior? Is there a way to provide constraints, e.g. value>=0, along with the initial value to force the "walk" in a certain direction?

Thanks!

1 Answer 1

2

There is nothing under the hood of the Uninformative prior (literally) -- it returns a log-likelihood of zero irrespective of the arguments passed to it. If you want to constrain it, the easiest approach is to use a factor potential to inject a log-likelihood term with the particular constraints you want (I'm assuming you are dealing with PyMC 2.3 here, but the same goes with PyMC 3).

x = Uninformative('x', value=1)

@potential
def x_pos(x=x):
    if x<=0:
        return -inf
    return 0
1
  • When I want to use MAP.fit, I find it helps to use a "soft constraint", i.e. return -1e6 * x**2 instead of -inf when the constraint is violated. This helps the hill-climber find its way. Sep 8, 2014 at 3:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.