Table Of Contents
Table Of Contents

gluonts.model.wavenet package

class gluonts.model.wavenet.WaveNet(bin_values: List[float], n_residue: int, n_skip: int, dilation_depth: int, n_stacks: int, act_type: str, cardinality: List[int], embedding_dimension: int, pred_length: int, **kwargs)[source]

Bases: mxnet.gluon.block.HybridBlock

static get_receptive_field(dilation_depth, n_stacks)[source]

Return the length of the receptive field

hybrid_forward(F, feat_static_cat: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], past_target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], past_observed_values: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], past_time_feat: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], future_time_feat: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], future_target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], future_observed_values: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], scale: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]

Overrides to construct symbolic graph for this Block.

Parameters:
  • x (Symbol or NDArray) – The first input tensor.
  • *args (list of Symbol or list of NDArray) – Additional input tensors.
class gluonts.model.wavenet.WaveNetEstimator(freq: str, prediction_length: int, trainer: gluonts.trainer._base.Trainer = gluonts.trainer._base.Trainer(batch_size=32, clip_gradient=10.0, ctx=None, epochs=200, hybridize=False, init="xavier", learning_rate=0.01, learning_rate_decay_factor=0.5, minimum_learning_rate=5e-05, num_batches_per_epoch=50, patience=10, weight_decay=1e-08), cardinality: List[int] = [1], seasonality: Optional[int] = None, embedding_dimension: int = 5, num_bins: int = 1024, hybridize_prediction_net: bool = False, n_residue=24, n_skip=32, dilation_depth: Optional[int] = None, n_stacks: int = 1, train_window_length: int = 1000, temperature: float = 1.0, act_type: str = 'elu', num_parallel_samples: int = 200)[source]

Bases: gluonts.model.estimator.GluonEstimator

Model with Wavenet architecture and quantized target.

Parameters:
  • freq – Frequency of the data to train on and predict
  • prediction_length – Length of the prediction horizon
  • trainer – Trainer object to be used (default: Trainer())
  • cardinality – Number of values of the each categorical feature (default: [1])
  • embedding_dimension – Dimension of the embeddings for categorical features (the same dimension is used for all embeddings, default: 5)
  • num_bins – Number of bins used for quantization of signal (default: 1024)
  • hybridize_prediction_net – Boolean (default: False)
  • n_residue – Number of residual channels in wavenet architecture (default: 24)
  • n_skip – Number of skip channels in wavenet architecture (default: 32)
  • dilation_depth – Number of dilation layers in wavenet architecture. If set to None (default), dialation_depth is set such that the receptive length is at least as long as typical seasonality for the frequency and at least 2 * prediction_length.
  • n_stacks – Number of dilation stacks in wavenet architecture (default: 1)
  • temperature – Temparature used for sampling from softmax distribution. For temperature = 1.0 (default) sampling is according to estimated probability.
  • act_type – Activation type used after before output layer (default: “elu”). Can be any of ‘elu’, ‘relu’, ‘sigmoid’, ‘tanh’, ‘softrelu’, ‘softsign’.
  • num_parallel_samples – Number of evaluation samples per time series to increase parallelism during inference. This is a model optimization that does not affect the accuracy (default: 200)
create_predictor(transformation: gluonts.transform.Transformation, trained_network: mxnet.gluon.block.HybridBlock, bin_values: numpy.ndarray) → gluonts.model.predictor.Predictor[source]

Create and return a predictor object.

Returns:A predictor wrapping a HybridBlock used for inference.
Return type:Predictor
create_transformation(bin_edges: numpy.ndarray, pred_length: int) → gluonts.transform.Transformation[source]

Create and return the transformation needed for training and inference.

Returns:The transformation that will be applied entry-wise to datasets, at training and inference time.
Return type:Transformation
train(training_data: gluonts.dataset.common.Dataset, validation_data: Optional[gluonts.dataset.common.Dataset] = None) → gluonts.model.predictor.Predictor[source]

Train the estimator on the given data.

Parameters:
  • training_data – Dataset to train the model on.
  • validation_data – Dataset to validate the model on during training.
Returns:

The predictor containing the trained model.

Return type:

Predictor

class gluonts.model.wavenet.WaveNetSampler(bin_values: List[float], num_samples: int, temperature: float = 1.0, **kwargs)[source]

Bases: gluonts.model.wavenet._network.WaveNet

Runs Wavenet generation in an auto-regressive manner using caching for speedup [PKC+16].

Same arguments as WaveNet. In addition

Parameters:
  • pred_length – Length of the prediction horizon
  • num_samples – Number of sample paths to generate in parallel in the graph
  • temperature – If set to 1.0 (default), sample according to estimated probabilities, if set to 0.0 most likely sample at each step is chosen.
  • post_transform – An optional post transform that will be applied to the samples
hybrid_forward(F, feat_static_cat: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], past_target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], past_observed_values: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], past_time_feat: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], future_time_feat: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], scale: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]

Overrides to construct symbolic graph for this Block.

Parameters:
  • x (Symbol or NDArray) – The first input tensor.
  • *args (list of Symbol or list of NDArray) – Additional input tensors.