You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/contributing/developer_guide_implementing_distribution.md
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,8 @@ This guide provides an overview on how to implement a distribution for version 4
4
4
It is designed for developers who wish to add a new distribution to the library.
5
5
Users will not be aware of all this complexity and should instead make use of helper methods such as (TODO).
6
6
7
-
PyMC {class}`~pymc.distributions.Distribution` build on top of Aesara's {class}`~aesara.tensor.random.op.RandomVariable`, and implement `logp`, `logcdf` and `get_moment` methods as well as other initialization and validation helpers, most notably `shape/dims`, alternative parametrizations, and default `transforms`.
7
+
PyMC {class}`~pymc.distributions.Distribution` builds on top of Aesara's {class}`~aesara.tensor.random.op.RandomVariable`, and implements `logp`, `logcdf` and `get_moment` methods as well as other initialization and validation helpers.
8
+
Most notably `shape/dims` kwargs, alternative parametrizations, and default `transforms`.
8
9
9
10
Here is a summary check-list of the steps needed to implement a new distribution.
10
11
Each section will be expanded below:
@@ -153,8 +154,8 @@ class Blah(PositiveContinuous):
153
154
# the rv_op needs in order to be instantiated
154
155
returnsuper().dist([param1, param2], **kwargs)
155
156
156
-
# get_moment returns the stable moment from which to start sampling for the
157
-
#distribution given the implicit `rv`, `size` and `param1` ... `paramN`
157
+
# get_moment returns a symbolic expression for the stable moment from which to start sampling
158
+
#the variable, given the implicit `rv`, `size` and `param1` ... `paramN`
158
159
defget_moment(rv, size, param1, param2):
159
160
moment, _ = at.broadcast_arrays(param1, param2)
160
161
ifnot rv_size_is_none(size):
@@ -204,7 +205,7 @@ For a quick check that things are working you can try the following:
Tests for the `get_moment` method are contained in `pymc/tests/test_distributions_moments.py`, and make use of the function `assert_moment_is_expected`
0 commit comments