-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
for Bounded RV: 'HalfNormal' object has no attribute 'median' #3399
Comments
Hi @aakhmetz , I tried to look deeper into this. It's not just a problem with with pm.Model() as model:
n = pm.Normal('n', 1.0, 1.0)
par1 = pm.Bound(pm.Normal, upper=n)('par1', mu=2.0, sd=1.0) while the following will throw an error with pm.Model() as model:
n = pm.Normal('n', 1.0, 1.0)
par1 = pm.Bound(pm.Normal, upper=n)('par1', 2.0, 1.0)
def dist(cls, *args, **kwargs):
dist = object.__new__(cls)
dist.__init__(*args, **kwargs)
return dist At dist.init() thus: When written as pm.Bound(pm.Normal, upper=n)('par1', mu=2.0, sd=1.0)
However, when written as pm.Bound(pm.Normal, upper=n)('par1', 2.0, 1.0)
@twiecki , @ColCarroll, @canyon289 do you have any idea to proceed with this? I am trying to think of something which would stop the different sets of arguments from merging into one or always require parameter names when creating I am new to pymc3 and trying to contribute thanks in advance 😅 |
Wow -- this is tricky: thank you for the helpful writeup. I think I see what you're saying. There is a lot of shuffling arguments around to internal functions -- do you think _ContinuousBounded(name, self.distribution, self.lower, self.upper, *args, **kwargs) with something like
That seems like it might be straightforward, and not change any of the public API, right? |
@ColCarroll thanks for the response! I will look into it and update soon 🔜 |
@ColCarroll I initially tried to convert all arguments to keyword arguments but dist.init will put the positional arguments |
Closed by #3446 |
I use a simple code:
Two half normals, one of which is bounded, then the default parameter value in S is not set to
sd
ortau
as one may expect. The code above gives an error:The following code works as expected:
Please provide any additional information below.
It would be nice to have some consistency: if both
D = pm.HalfNormal('D',1)
andD = pm.HalfNormal('D',sd=1)
work, then the variant withS = pm.Bound(pm.HalfNormal, upper=D)('S', 1)
would work as well.Versions and main components
The text was updated successfully, but these errors were encountered: