symbolic_pymc.relations.theano package

Submodules

symbolic_pymc.relations.theano.conjugates module

symbolic_pymc.relations.theano.distributions module

Relations pertaining to probability distributions.

symbolic_pymc.relations.theano.distributions.constant_neq(lvar, val)

Assert that a constant graph variable is not equal to a specific value.

Scalar values are broadcast across arrays.

XXX: This goal is non-relational

symbolic_pymc.relations.theano.distributions.scale_loc_transform(in_expr, out_expr)

Create relations for lifting and sinking scale and location parameters of distributions.

I.e. f(a + b*x) -> a + b * f(x)

For example, in_expr: f(a + b*x) == out_expr: a + b * f(x).

TODO: Match larger distribution families and perform transforms from there.

XXX: PyMC3 rescaling issue (?) doesn’t allow us to take the more general approach, which involves separate scale and location rewrites.

symbolic_pymc.relations.theano.linalg module

symbolic_pymc.relations.theano.linalg.normal_normal_regression(Y, X, beta, Y_args_tail=None, beta_args=None)

Create a goal for a normal-normal regression of the form Y ~ N(X * beta, sd**2).

symbolic_pymc.relations.theano.linalg.normal_qr_transform(in_expr, out_expr)

Produce a relation for normal-normal regression and its QR-reduced form.

TODO XXX: This isn’t entirely correct (e.g. it needs to also transform the variance terms), but it demonstrates all the requisite functionality for this kind of model reformulation.

symbolic_pymc.relations.theano.linalg.update_name_suffix(x, old_x, suffix)

Module contents

symbolic_pymc.relations.theano.non_obs_walko(relation, a, b)

Construct a goal that applies a relation to all nodes above an observed random variable.

This is useful if you don’t want to apply relations to an observed random variable, but you do want to apply them to every term above one and ultimately reproduce the entire graph (observed RV included).

relation: function

A binary relation/goal constructor function

a: lvar or meta graph

The left-hand side of the relation.

b: lvar or meta graph

The right-hand side of the relation