zuko.flows.gaussianization#

Gaussianization flows.

Classes#

ElementWiseTransform

Creates a lazy element-wise transformation.

GF

Creates a gaussianization flow (GF).

Descriptions#

class zuko.flows.gaussianization.ElementWiseTransform(features, context=0, univariate=<class 'zuko.transforms.MonotonicAffineTransform'>, shapes=((), ()), **kwargs)#

Creates a lazy element-wise transformation.

Parameters:
  • features (int) – The number of features.

  • context (int) – The number of context features.

  • univariate (Callable[[...], Transform]) – The univariate transformation constructor.

  • shapes (Sequence[Size]) – The shapes of the univariate transformation parameters.

  • kwargs – Keyword arguments passed to zuko.nn.MLP.

Example

>>> t = ElementWiseTransform(3, 4)
>>> t
ElementWiseTransform(
  (base): MonotonicAffineTransform()
  (hyper): MLP(
    (0): Linear(in_features=4, out_features=64, bias=True)
    (1): ReLU()
    (2): Linear(in_features=64, out_features=64, bias=True)
    (3): ReLU()
    (4): Linear(in_features=64, out_features=6, bias=True)
  )
)
>>> x = torch.randn(3)
>>> x
tensor([2.1983,  -1.3182,  0.0329])
>>> c = torch.randn(4)
>>> y = t(c)(x)
>>> t(c).inv(y)
tensor([2.1983,  -1.3182,  0.0329])
class zuko.flows.gaussianization.GF(features, context=0, transforms=3, components=8, **kwargs)#

Creates a gaussianization flow (GF).

Warning

Invertibility is only guaranteed for features within the interval \([-10, 10]\). It is recommended to standardize features (zero mean, unit variance) before training.

References

Gaussianization Flows (Meng et al., 2020)
Parameters:
  • features (int) – The number of features.

  • context (int) – The number of context features.

  • transforms (int) – The number of coupling transformations.

  • components (int) – The number of mixture components in each transformation.

  • kwargs – Keyword arguments passed to ElementWiseTransform.