Skip to content

Abstract Bijectors¤

distreqx.bijectors.AbstractBijector ¤

Differentiable bijection that knows to compute its Jacobian determinant.

A bijector implements a differentiable and bijective transformation f, whose inverse is also differentiable (f is called a "diffeomorphism"). A bijector can be used to transform a continuous random variable X to a continuous random variable Y = f(X) in the context of TransformedDistribution.

Typically, a bijector subclass will implement the following methods:

  • forward_and_log_det(x) (required)
  • inverse_and_log_det(y) (optional)

The remaining methods are defined in terms of the above by default.

Subclass requirements:

  • Subclasses must ensure that f is differentiable and bijective, and that their methods correctly implement f^{-1}, J(f) and J(f^{-1}). Distreqx will assume these properties hold, and will make no attempt to verify them.
__init__() ¤

Initialize self. See help(type(self)) for accurate signature.

forward(x: PyTree) -> PyTree ¤

Computes \(y = f(x)\).

inverse(y: PyTree) -> PyTree ¤

Computes \(x = f^{-1}(y)\).

forward_log_det_jacobian(x: PyTree) -> PyTree ¤

Computes \(\log|\det J(f)(x)|\).

inverse_log_det_jacobian(y: PyTree) -> PyTree ¤

Computes \(\log|\det J(f^{-1})(y)|\).

forward_and_log_det(x: PyTree) -> tuple ¤

Computes \(y = f(x)\) and \(\log|\det J(f)(x)|\).

inverse_and_log_det(y: Array) -> tuple ¤

Computes \(x = f^{-1}(y)\) and \(\log|\det J(f^{-1})(y)|\).

same_as(other) -> bool ¤

Returns True if this bijector is guaranteed to be the same as other.

distreqx.bijectors.AbstractInvLogDetJacBijector(distreqx.bijectors.AbstractBijector) ¤

AbstractBijector + concrete inverse_log_det_jacobian.

inverse_log_det_jacobian(y: PyTree) -> PyTree ¤

Computes \(\log|\det J(f^{-1})(y)|\).

distreqx.bijectors.AbstractFwdLogDetJacBijector(distreqx.bijectors.AbstractBijector) ¤

AbstractBijector + concrete forward_log_det_jacobian.

forward_log_det_jacobian(x: PyTree) -> PyTree ¤

Computes \(\log|\det J(f)(x)|\).

distreqx.bijectors.AbstractFowardInverseBijector(distreqx.bijectors.AbstractBijector) ¤

AbstractBijector + concrete forward and reverse.

forward(x: PyTree) -> PyTree ¤

Computes \(y = f(x)\).

inverse(y: PyTree) -> PyTree ¤

Computes \(x = f^{-1}(y)\).

distreqx.bijectors.AbstractLinearBijector(distreqx.bijectors.AbstractBijector) ¤

Base class for linear bijectors.

This class provides a base class for bijectors defined as f(x) = Ax, where A is a DxD matrix and x is a D-dimensional vector.

matrix property ¤

The matrix A of the transformation.

To be optionally implemented in a subclass.

Returns:

  • An array of shape (D, D).
__init__() ¤

Initialize self. See help(type(self)) for accurate signature.