Closed rmastand closed 1 year ago
You've specified tail behavior (what to do when outside the bins where the spline is defined) in the first case but not the second.
When I do specify tail behavior, I get
Traceback (most recent call last):
transforms_.append(MaskedPiecewiseCubicAutoregressiveTransform(features = n_features, hidden_features = 128, num_blocks = 8, tail_bound=3.5, context_features=1,tails="linear",num_bins = 10, dropout_probability = 0.0))
TypeError: __init__() got an unexpected keyword argument 'tail_bound'
So tail behavior does not seem to be implemented for the cubic transform?
Ah, MaskedPiecewiseCubicAutoregressiveTransform
is hardecoded to use a cubic_spline
not an unconstrained_cubic_spline
that can deal with unconstrained inputs.
In constrast, MaskedPiecewiseRationalQuadraticAutoregressiveTransform
has code that checks to see if there are tails and uses the appropriate transform.
At least in the first instance, you could check if altering the MaskedPiecewiseCubicAutoregressiveTransform
class to use unconstrained_cubic_spline
, or porting the few relevant lines from MaskedPiecewiseRationalQuadraticAutoregressiveTransform
, does what you want.
Closing as stale.
I am testing out a few different types of architectures for training normalising flows, and I am running into an unexpected bug.
The first architecture uses a
MaskedPiecewiseRationalQuadraticAutoregressiveTransform
:This architecture trains without issue, and sampling from the base distribution produces good results.
However, when I replace
MaskedPiecewiseRationalQuadraticAutoregressiveTransform
withMaskedPiecewiseCubicAutoregressiveTransform
, i.e.I get an error
It seems that both types of flows are implemented similarly in the
nflows
repo, so I am not sure why changing the type of transform would cause such an error to be thrown?