Skip to content

Commit 21e1998

Browse files
authored
Fix minor typos (#5110)
* Fix minor typo * Change V4 reference * Update a couple PyMC references
1 parent 6093fcd commit 21e1998

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/source/developer_guide_implementing_distribution.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ If it is, it should be added to the [Aesara library](https://github.com/aesara-d
2727

2828
In addition, it might not always be necessary to implement a new `RandomVariable`.
2929
For example if the new `Distribution` is just a special parametrization of an existing `Distribution`.
30-
This is the case of the `OrderedLogistic` and `OrderedProbit`, which are just special parametrizations of the `Categorial` distribution.
30+
This is the case of the `OrderedLogistic` and `OrderedProbit`, which are just special parametrizations of the `Categorical` distribution.
3131

3232
The following snippet illustrates how to create a new `RandomVariable`:
3333

@@ -67,7 +67,7 @@ class BlahRV(RandomVariable):
6767
# start with a NumPy `RandomState` object, then the distribution
6868
# parameters, and, finally, the size.
6969
#
70-
# This is effectively the v4 replacement for `Distribution.random`.
70+
# This is effectively the PyMC replacement for `Distribution.random`.
7171
@classmethod
7272
def rng_fn(
7373
cls,
@@ -115,7 +115,7 @@ blah([0, 0], [1, 2], size=(10, 2)).eval()
115115
## 2. Inheriting from a PyMC base `Distribution` class
116116

117117
After implementing the new `RandomVariable` `Op`, it's time to make use of it in a new PyMC {class}`pymc.distributions.Distribution`.
118-
PyMC works in a very {term}`functional <Functional Programming>` way, and the `distribution` classes are there mostly to facilitate porting the `v3` code to the new `v4` version, add PyMC API features and keep related methods organized together.
118+
PyMC works in a very {term}`functional <Functional Programming>` way, and the `distribution` classes are there mostly to facilitate porting the `PyMC3` code to the new `PyMC` version, add PyMC API features and keep related methods organized together.
119119
In practice, they take care of:
120120

121121
1. Linking ({term}`Dispatching`) a rv_op class with the corresponding logp and logcdf methods.
@@ -186,7 +186,7 @@ Some notes:
186186
1. A distribution should at the very least inherit from {class}`~pymc.distributions.Discrete` or {class}`~pymc.distributions.Continuous`. For the latter, more specific subclasses exist: `PositiveContinuous`, `UnitContinuous`, `BoundedContinuous`, `CircularContinuous`, which specify default transformations for the variables. If you need to specify a one-time custom transform you can also override the `__new__` method, as is done for the {class}`~pymc.distributions.multivariate.Dirichlet`.
187187
1. If a distribution does not have a corresponding `random` implementation, a `RandomVariable` should still be created that raises a `NotImplementedError`. This is the case for the {class}`~pymc.distributions.continuous.Flat`. In this case it will be necessary to provide a standard `initval` by
188188
overriding `__new__`.
189-
1. As mentioned above, `v4` works in a very {term}`functional <Functional Programming>` way, and all the information that is needed in the `logp` and `logcdf` methods is expected to be "carried" via the `RandomVariable` inputs. You may pass numerical arguments that are not strictly needed for the `rng_fn` method but are used in the `logp` and `logcdf` methods. Just keep in mind whether this affects the correct shape inference behavior of the `RandomVariable`. If specialized non-numeric information is needed you might need to define your custom`_logp` and `_logcdf` {term}`Dispatching` functions, but this should be done as a last resort.
189+
1. As mentioned above, `PyMC` works in a very {term}`functional <Functional Programming>` way, and all the information that is needed in the `logp` and `logcdf` methods is expected to be "carried" via the `RandomVariable` inputs. You may pass numerical arguments that are not strictly needed for the `rng_fn` method but are used in the `logp` and `logcdf` methods. Just keep in mind whether this affects the correct shape inference behavior of the `RandomVariable`. If specialized non-numeric information is needed you might need to define your custom`_logp` and `_logcdf` {term}`Dispatching` functions, but this should be done as a last resort.
190190
1. The `logcdf` method is not a requirement, but it's a nice plus!
191191

192192
For a quick check that things are working you can try the following:

0 commit comments

Comments
 (0)