A mixture (same-family) Keras layer.

layer_mixture_same_family(
  object,
  num_components,
  component_layer,
  convert_to_tensor_fn = tfp$distributions$Distribution$sample,
  validate_args = FALSE,
  ...
)

Arguments

object

Model or layer object

num_components

Number of component distributions in the mixture distribution.

component_layer

Function that, given a tensor of shape batch_shape + [num_components, component_params_size], returns a tfd.Distribution-like instance that implements the component distribution (with batch shape batch_shape + [num_components]) -- e.g., a TFP distribution layer.

convert_to_tensor_fn

A callable that takes a tfd$Distribution instance and returns a tf$Tensor-like object. Default value: tfd$distributions$Distribution$sample.

validate_args

Logical, default FALSE. When TRUE distribution parameters are checked for validity despite possibly degrading runtime performance. When FALSE invalid inputs may silently render incorrect outputs. Default value: FALSE. @param ... Additional arguments passed to args of keras::create_layer.

...

Additional arguments passed to args of keras::create_layer.

Value

a Keras layer

See also