Skip to content

Commit 9a436b7

Browse files
committed
Move SymbolicDistribution docstring to body of class
1 parent 343869a commit 9a436b7

File tree

1 file changed

+34
-32
lines changed

1 file changed

+34
-32
lines changed

pymc/distributions/distribution.py

+34-32
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,40 @@ def dist(
364364

365365

366366
class SymbolicDistribution:
367+
"""Symbolic statistical distribution
368+
369+
While traditional PyMC distributions are represented by a single RandomVariable
370+
graph, Symbolic distributions correspond to a larger graph that contains one or
371+
more RandomVariables and an arbitrary number of deterministic operations, which
372+
represent their own kind of distribution.
373+
374+
The graphs returned by symbolic distributions can be evaluated directly to
375+
obtain valid draws and can further be parsed by Aeppl to derive the
376+
corresponding logp at runtime.
377+
378+
Check pymc.distributions.Censored for an example of a symbolic distribution.
379+
380+
Symbolic distributions must implement the following classmethods:
381+
cls.dist
382+
Performs input validation and converts optional alternative parametrizations
383+
to a canonical parametrization. It should call `super().dist()`, passing a
384+
list with the default parameters as the first and only non keyword argument,
385+
followed by other keyword arguments like size and rngs, and return the result
386+
cls.num_rngs
387+
Returns the number of rngs given the same arguments passed by the user when
388+
calling the distribution
389+
cls.ndim_supp
390+
Returns the support of the symbolic distribution, given the default set of
391+
parameters. This may not always be constant, for instance if the symbolic
392+
distribution can be defined based on an arbitrary base distribution.
393+
cls.rv_op
394+
Returns a TensorVariable that represents the symbolic distribution
395+
parametrized by a default set of parameters and a size and rngs arguments
396+
cls.change_size
397+
Returns an equivalent symbolic distribution with a different size. This is
398+
analogous to `pymc.aesaraf.change_rv_size` for `RandomVariable`s.
399+
"""
400+
367401
def __new__(
368402
cls,
369403
name: str,
@@ -379,37 +413,6 @@ def __new__(
379413
"""Adds a TensorVariable corresponding to a PyMC symbolic distribution to the
380414
current model.
381415
382-
While traditional PyMC distributions are represented by a single RandomVariable
383-
graph, Symbolic distributions correspond to a larger graph that contains one or
384-
more RandomVariables and an arbitrary number of deterministic operations, which
385-
represent their own kind of distribution.
386-
387-
The graphs returned by symbolic distributions can be evaluated directly to
388-
obtain valid draws and can further be parsed by Aeppl to derive the
389-
corresponding logp at runtime.
390-
391-
Check pymc.distributions.Censored for an example of a symbolic distribution.
392-
393-
Symbolic distributions must implement the following classmethods:
394-
cls.dist
395-
Performs input validation and converts optional alternative parametrizations
396-
to a canonical parametrization. It should call `super().dist()`, passing a
397-
list with the default parameters as the first and only non keyword argument,
398-
followed by other keyword arguments like size and rngs, and return the result
399-
cls.num_rngs
400-
Returns the number of rngs given the same arguments passed by the user when
401-
calling the distribution
402-
cls.ndim_supp
403-
Returns the support of the symbolic distribution, given the default set of
404-
parameters. This may not always be constant, for instance if the symbolic
405-
distribution can be defined based on an arbitrary base distribution.
406-
cls.rv_op
407-
Returns a TensorVariable that represents the symbolic distribution
408-
parametrized by a default set of parameters and a size and rngs arguments
409-
cls.change_size
410-
Returns an equivalent symbolic distribution with a different size. This is
411-
analogous to `pymc.aesaraf.change_rv_size` for `RandomVariable`s.
412-
413416
Parameters
414417
----------
415418
cls : type
@@ -524,7 +527,6 @@ def dist(
524527
The inputs to the `RandomVariable` `Op`.
525528
shape : int, tuple, Variable, optional
526529
A tuple of sizes for each dimension of the new RV.
527-
528530
An Ellipsis (...) may be inserted in the last position to short-hand refer to
529531
all the dimensions that the RV would get if no shape/size/dims were passed at all.
530532
size : int, tuple, Variable, optional

0 commit comments

Comments
 (0)