Is a single Bound
thing a thing that can be used once or does it define a class-like thing that can be used over and over. In the PyMC3 documents, we see this example:
with pm.Model() as model:
BoundedNormal = pm.Bound(pm.Normal, lower=0.0)
x = BoundedNormal('x', mu=1.0, sd=3.0)
But it’s not clear from the documentation, or from the examples if this BoundedNormal
thing is class-like and can be instantiated multiple times.
For example, is the following also legitimate?
with pm.Model() as model:
BoundedNormal = pm.Bound(pm.Normal, lower=0.0)
x = BoundedNormal('x', mu=1.0, sd=3.0)
y = BoundedNormal('y', mu=2.0, sd=1.0)
or do we need to do this:
with pm.Model() as model:
BoundedNormal = pm.Bound(pm.Normal, lower=0.0)
x = BoundedNormal('x', mu=1.0, sd=3.0)
AnotherBoundedNormal = pm.Bound(pm.Normal, lower=0.0)
y = AnotherBoundedNormal('y', mu=2.0, sd=1.0)
?
BoundedNormal
is class-like and can be instantiated multiple times. So you can do:
with pm.Model() as model:
BoundedNormal = pm.Bound(pm.Normal, lower=0.0)
x = BoundedNormal('x', mu=1.0, sd=3.0)
y = BoundedNormal('y', mu=2.0, sd=1.0)
If it’s not too difficult, it might be nice to put this example in the docs for Bound
so that the reader recognizes this.
pm.Bound
seems like a sort of odd thing – it returns an RV constructor function, if I understand correctly. It’s not a class itself, although it looks like one, and there is a bounded RV class.
Some more documentations would sure helps - I think it would be good to added Bound distribution to http://docs.pymc.io/prob_dists.html. including information like bounded distribution does not normalized to 1 etc. Would you like to submit a pull request ;-)?
Is this in docs/source/api/bounds.rst
? I don’t actually know much about how the documentation is structured. If so, I could have a try. If not, please point me at the right location.
Oh right that’s actually a better page. Although we should definitely have a hyper link in the distribution doc page to point to the Bound doc page. I think currently it is not immediately obvious where is this information (at least it is not on the left hand side panel?)
I have submitted a pull request about this.
1 Like