Skip to content

Commit ba6df63

Browse files
accepting_michaels_suggestions
Co-authored-by: Michael Osthege <[email protected]>
1 parent 37b5024 commit ba6df63

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/source/contributing/developer_guide_implementing_distribution.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ This guide provides an overview on how to implement a distribution for version 4
44
It is designed for developers who wish to add a new distribution to the library.
55
Users will not be aware of all this complexity and should instead make use of helper methods such as (TODO).
66

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`.
89

910
Here is a summary check-list of the steps needed to implement a new distribution.
1011
Each section will be expanded below:
@@ -153,8 +154,8 @@ class Blah(PositiveContinuous):
153154
# the rv_op needs in order to be instantiated
154155
return super().dist([param1, param2], **kwargs)
155156

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`
158159
def get_moment(rv, size, param1, param2):
159160
moment, _ = at.broadcast_arrays(param1, param2)
160161
if not rv_size_is_none(size):
@@ -204,7 +205,7 @@ For a quick check that things are working you can try the following:
204205
```python
205206

206207
import pymc as pm
207-
from pm.distributions.distribution import get_moment
208+
from pymc.distributions.distribution import get_moment
208209

209210
# pm.blah = pm.Uniform in this example
210211
blah = pm.Blah.dist([0, 0], [1, 2])
@@ -369,7 +370,7 @@ def test_blah_logcdf(self):
369370

370371
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`
371372
which checks if:
372-
1. Moments return `expected` values
373+
1. Moments return the `expected` values
373374
1. Moments have the expected size and shape
374375

375376
```python

0 commit comments

Comments
 (0)