nessai.flows.nsf

Implementation of Neural Spline Flows.

Module Contents

Classes

NeuralSplineFlow

Implementation of Neural Spline Flow

class nessai.flows.nsf.NeuralSplineFlow(features, hidden_features, num_layers, num_blocks_per_layer, num_bins=8, context_features=None, activation=F.relu, dropout_probability=0.0, batch_norm_within_layers=False, batch_norm_between_layers=False, apply_unconditional_transform=False, linear_transform='permutation', tails='linear', tail_bound=5.0, distribution=None, **kwargs)

Bases: nessai.flows.base.NFlow

Implementation of Neural Spline Flow

See: https://arxiv.org/abs/1906.04032

Parameters:
featuresint

Number of features (dimensions) in the data space

hidden_featuresint

Number of neurons per layer in each neural network

num_layersint

Number of coupling transformations

num_blocks_per_layerint

Number of layers (or blocks for resnet) per neural network for each coupling transform

num_binsint, optional (8)

Number of bins to use for each spline

context_featuresint, optional

Number of context (conditional) parameters.

activationfunction

Activation function implemented in torch

dropout_probabilityfloat, optional (0.0)

Dropout probability used in each layer of the neural network

batch_norm_within_layersbool, optional (False)

Enable or disable batch norm within the neural network for each coupling transform

batch_norm_between_layersbool, optional (False)

Enable or disable batch norm between coupling transforms

linear_transform{‘permutation’, ‘lu’, ‘svd’}

Linear transform to use between coupling layers. Not recommended when using a custom mask.

distribution:obj: glasflow.nflows.distributions.Distribution

Distribution for the latent space.

kwargsdict

Additional kwargs parsed to the spline constructor, e.g. tails or tail_bound. See nflows for details