Skip to contents

Creates network architecture as described here. Implementation uses code from here.

Usage

create_model_wavenet(
  filters = 16,
  kernel_size = 2,
  residual_blocks,
  maxlen,
  input_tensor = NULL,
  initial_kernel_size = 32,
  initial_filters = 32,
  output_channels = 4,
  output_activation = "softmax",
  solver = "adam",
  learning_rate = 0.001,
  compile = TRUE,
  verbose = TRUE,
  model_seed = NULL,
  mixed_precision = FALSE,
  mirrored_strategy = NULL
)

Arguments

filters

Integer, the dimensionality of the output space (i.e. the number of output filters in the convolution).

kernel_size

An integer or list of a single integer, specifying the length of the 1D convolution window.

residual_blocks

if a single integer: the number of residual blocks in the model - the dilation rate of each block `i` is calculated by `2^i`. If a vector, then it's used as the dilation rate of each residual block.

maxlen

Length of predictor sequence.

input_tensor

Tensor to use as input for the model. Usually a 3d tensor.

initial_kernel_size

kernel size of the first causal convolution.

initial_filters

number of filters in the initial causal convolution.

output_channels

number of channels in the output.

output_activation

activation function for the last layer. Default: 'softmax'

solver

Optimization method, options are "adam", "adagrad", "rmsprop" or "sgd".

learning_rate

Learning rate for optimizer.

compile

Whether to compile the model.

verbose

Boolean.

model_seed

Set seed for model parameters in tensorflow if not NULL.

mixed_precision

Whether to use mixed precision (https://www.tensorflow.org/guide/mixed_precision).

mirrored_strategy

Whether to use distributed mirrored strategy. If NULL, will use distributed mirrored strategy only if >1 GPU available.

Value

A keras model implementing wavenet architecture.

Examples

if (FALSE) { # reticulate::py_module_available("tensorflow")

model <- create_model_wavenet(residual_blocks = 2^rep(1:4, 2), maxlen = 1000)
 
}