Skip to content

Automatically convert PyMC3 Distributions to RandomVariables #110

@brandonwillard

Description

@brandonwillard

We can create a function that constructs a RandomVariable class for a given PyMC3 Distribution class. The basic requirements are

  1. that Add log-likelihoods to RandomVariables #109 be in place and log_lik = Distribution.logp(out_var),
  2. Distribution.__init__ is utilized in RandomVariable.make_node and its signature is used to determine the signature of RandomVariable.make_node, as well (see the examples here),
  3. and Distribution.random is the backing implementation within RandomVariable.perform.

One complication that comes to mind involves requirement 3.; most implementations of Distribution.random use draw_values, which would be redundant within RandomVariable.perform, since pre-computed samples of all dependent terms already appear as arguments
to RandomVariable.perform. We would have to override draw_values in that context so that it simply returns RandomVariable.perform arguments. It seems like we could use something like mock to accomplish that easily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpymc3This issue relates to PyMC3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions