layer_autoregressive
takes as input a Tensor of shape [..., event_size]
and returns a Tensor of shape [..., event_size, params]
.
The output satisfies the autoregressive property. That is, the layer is
configured with some permutation ord
of {0, ..., event_size-1}
(i.e., an
ordering of the input dimensions), and the output output[batch_idx, i, ...]
for input dimension i
depends only on inputs x[batch_idx, j]
where
ord(j) < ord(i)
.
layer_autoregressive( object, params, event_shape = NULL, hidden_units = NULL, input_order = "left-to-right", hidden_degrees = "equal", activation = NULL, use_bias = TRUE, kernel_initializer = "glorot_uniform", validate_args = FALSE, ... )
object | Model or layer object |
---|---|
params | integer specifying the number of parameters to output per input. |
event_shape |
|
hidden_units |
|
input_order | Order of degrees to the input units: 'random',
'left-to-right', 'right-to-left', or an array of an explicit order. For
example, 'left-to-right' builds an autoregressive model:
|
hidden_degrees | Method for assigning degrees to the hidden units: 'equal', 'random'. If 'equal', hidden units in each layer are allocated equally (up to a remainder term) to each degree. Default: 'equal'. |
activation | An activation function. See |
use_bias | Whether or not the dense layers constructed in this layer
should have a bias term. See |
kernel_initializer | Initializer for the kernel weights matrix. Default: 'glorot_uniform'. |
validate_args |
|
... | Additional keyword arguments passed to the |
a Keras layer
The autoregressive property allows us to use
output[batch_idx, i]
to parameterize conditional distributions:
p(x[batch_idx, i] | x[batch_idx, ] for ord(j) < ord(i))
which give us a tractable distribution over input x[batch_idx]
:
p(x[batch_idx]) = prod_i p(x[batch_idx, ord(i)] | x[batch_idx, ord(0:i)])
For example, when params
is 2, the output of the layer can parameterize
the location and log-scale of an autoregressive Gaussian distribution.
Other layers:
layer_conv_1d_flipout()
,
layer_conv_1d_reparameterization()
,
layer_conv_2d_flipout()
,
layer_conv_2d_reparameterization()
,
layer_conv_3d_flipout()
,
layer_conv_3d_reparameterization()
,
layer_dense_flipout()
,
layer_dense_local_reparameterization()
,
layer_dense_reparameterization()
,
layer_dense_variational()
,
layer_variable()