-
Notifications
You must be signed in to change notification settings - Fork 246
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
Bug: Dirichlet distribution got invalid concentration parameter for BetaDistribution #1237
Bug: Dirichlet distribution got invalid concentration parameter for BetaDistribution #1237
Conversation
218c589
to
b032a45
Compare
b032a45
to
a21a5e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice solution! Thanks, @MarcoGorelli!
numpyro/distributions/transforms.py
Outdated
@@ -1121,6 +1121,19 @@ def _transform_to_interval(constraint): | |||
) | |||
|
|||
|
|||
@biject_to.register(constraints.open_interval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add this to the above def _transform_to_interval(constraint):
, so no need to reimplement the transform.
Thanks @fehiepsi ! I tried chaining the decorators, i.e. @biject_to.register( constraints.open_interval)
@biject_to.register(constraints.interval) but that didn't work, so I modified |
numpyro/distributions/transforms.py
Outdated
for constraint in constraint_list: | ||
if isinstance(constraint, constraints.Constraint): | ||
constraint = type(constraint) | ||
self._registry[constraint] = factory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, really sorry, I think we need to return factory
here. Could you revert to the previous commit and add
def register(...):
...
return factory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right - that works, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @MarcoGorelli!
closes #1206
Couple of changes needed to happen:
mean
parameter ofBetaProportion
should be between 0 and 1 not inclusive of the extremes, otherwise one of theconcentration
parameters will be0
Beta
needs to happen before that ofDirichelet
, as suggested in the issue