Skip to content

Allow passing name as kwarg to pm.Bound RVs #3152

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

Merged
merged 1 commit into from
Aug 13, 2018

Conversation

aseyboldt
Copy link
Member

fix #3149.

@@ -1183,6 +1183,10 @@ def test_bound():
assert rand.dtype in [np.int16, np.int32, np.int64]
assert rand >= 5 and rand <= 8

with pm.Model():
BoundPoisson = pm.Bound(pm.Poisson, upper=6)
BoundPoisson(name="y", mu=1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmmmmmmm we never do this... it is always BoundPoisson("y", mu=1)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(You must have been playing around with TFP and Edwards2 lately LOL)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't me :-)
I think an explicit name should work though. That is just the norm in python.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. We do have the same pattern in FreeRV etc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works:

with pm.Model() as model:
    pm.Normal(name='a')
    pm.Normal(name='b', observed=[0.])

This fails without this patch:

    BoundPoisson = pm.Bound(pm.Poisson, upper = 6)
    y = BoundPoisson(name="y", mu=1)
@aseyboldt aseyboldt merged commit fb50e9c into pymc-devs:master Aug 13, 2018
@aseyboldt aseyboldt deleted the kwargs-bounds branch August 13, 2018 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot apply bound to Poisson distribution
2 participants