general_coupling module

Abstract class for coupling cells

class GeneralCouplingCell(*args, **kwargs)[source]

Bases: zunis.models.flows.general_flow.GeneralFlow

Abstract class for coupling cell

Parameters
  • d (int) – dimension of the space

  • transform (function or InvertibleTransform) – bijective variable transform that maps the unit hypercube (in d-sum(mask) dimensions) to itself given some parameters. It should have the same signature as InvertibleTransform.forward

  • mask (list of bool) – indicates which variables are passed (y_N) through and which are transformed (y_M)

flow(y)[source]

Apply the variable change on a batch of points y

training: bool[source]
transform_and_compute_jacobian(yj)[source]

Apply the variable change on a batch of points y and compute the jacobian

class InvertibleCouplingCell(*args, **kwargs)[source]

Bases: zunis.models.flows.coupling_cells.general_coupling.GeneralCouplingCell

An invertible coupling cell works exactly the same as a general coupling cell but its transform admits and inverse transformation.

Parameters
  • d (int) – dimension of the space

  • transform (InvertibleTransform) – bijective variable transform that maps the unit hypercube (in d-sum(mask) dimensions) to itself given some parameters.

  • mask (list of bool) – indicates which variables are passed (y_N) through and which are transformed (y_M)

invert()[source]

Change the running mode from forward to inverse (invert the change of variable)

runs_forward()[source]

Check the running mode: True if forward and False if backward/inverse

training: bool[source]
not_list(l)[source]

Return the element wise negation of a list of booleans