pymc.SymbolicDistribution#

class pymc.SymbolicDistribution(name, *args, dims=None, initval=None, observed=None, total_size=None, transform=UNSET, **kwargs)[source]#

Symbolic statistical distribution

While traditional PyMC distributions are represented by a single RandomVariable graph, Symbolic distributions correspond to a larger graph that contains one or more RandomVariables and an arbitrary number of deterministic operations, which represent their own kind of distribution.

The graphs returned by symbolic distributions can be evaluated directly to obtain valid draws and can further be parsed by Aeppl to derive the corresponding logp at runtime.

Check pymc.distributions.Censored for an example of a symbolic distribution.

Symbolic distributions must implement the following classmethods: cls.dist

Performs input validation and converts optional alternative parametrizations to a canonical parametrization. It should call super().dist(), passing a list with the default parameters as the first and only non keyword argument, followed by other keyword arguments like size and rngs, and return the result

cls.ndim_supp

Returns the support of the symbolic distribution, given the default set of parameters. This may not always be constant, for instance if the symbolic distribution can be defined based on an arbitrary base distribution.

cls.rv_op

Returns a TensorVariable that represents the symbolic distribution parametrized by a default set of parameters and a size and rngs arguments

cls.change_size

Returns an equivalent symbolic distribution with a different size. This is analogous to pymc.aesaraf.change_rv_size for `RandomVariable`s.

Methods

SymbolicDistribution.__init__(*args, **kwargs)

SymbolicDistribution.dist(dist_params, *[, ...])

Creates a TensorVariable corresponding to the cls symbolic distribution.