paddlets.models.forecasting.dl.deepar
This implementation is based on the article DeepAR: Probabilistic forecasting with autoregressive recurrent networks .
- Updated features
Recursively decoding by mean: In prediction, we provide another decoding style besides sample paths raised in the original paper, mean of predicted distribution is used for next step’s input.
- class DeepARModel(in_chunk_len: int, out_chunk_len: int, rnn_type_or_module: str = 'LSTM', fcn_out_config: ~typing.Optional[~typing.List[int]] = None, hidden_size: int = 128, num_layers_recurrent: int = 1, dropout: float = 0.0, skip_chunk_len: int = 0, sampling_stride: int = 1, likelihood_model: ~paddlets.models.forecasting.dl.distributions.likelihood.Likelihood = <paddlets.models.forecasting.dl.distributions.likelihood.GaussianLikelihood object>, num_samples: int = 101, loss_fn: ~typing.Callable[[...], ~paddle.Tensor] = <bound method GaussianLikelihood.loss of <paddlets.models.forecasting.dl.distributions.likelihood.GaussianLikelihood object>>, regression_mode: str = 'mean', output_mode: str = 'quantiles', optimizer_fn: ~typing.Callable[[...], ~paddle.optimizer.optimizer.Optimizer] = <class 'paddle.optimizer.adam.Adam'>, optimizer_params: ~typing.Dict[str, ~typing.Any] = {'learning_rate': 0.0001}, eval_quantiles: ~typing.List[float] = [0.1, 0.5, 0.9], eval_metrics: ~typing.List[~paddlets.metrics.base.Metric] = [<paddlets.metrics.metrics.QuantileLoss object>], callbacks: ~typing.List[~paddlets.models.common.callbacks.callbacks.Callback] = [], batch_size: int = 128, max_epochs: int = 10, verbose: int = 1, patience: int = 4, seed: int = 0)[source]
Bases:
PaddleBaseModelImplDeepAR model.
- Parameters
in_chunk_len (int) – The size of the loopback window, i.e., the number of time steps feed to the model.
out_chunk_len (int) – The size of the forecasting horizon, i.e., the number of time steps output by the model.
rnn_type (str) – The type of the specific paddle RNN module (“GRU” or “LSTM”).
hidden_size (int) – The number of features in the hidden state h of the RNN module.
num_layers_recurrent (int) – The number of recurrent layers.
dropout (float) – The fraction of neurons that are dropped in all-but-last RNN layers.
skip_chunk_len (int) – Optional, the number of time steps between in_chunk and out_chunk for a single sample. The skip chunk is neither used as a feature (i.e. X) nor a label (i.e. Y) for a single sample. By default it will NOT skip any time steps.
sampling_stride (int, optional) – sampling intervals between two adjacent samples.
likelihood_model (Likelihood) – The distribution likelihood to be used for probability forecasting.
num_samples (int) – The sampling number for validation and prediction phase, it is used for computation of quantiles loss and the point forecasting result.
loss_fn (Callable[..., paddle.Tensor]) – The loss fucntion of probability forecasting respect to likelihood model.
regression_mode (str) – The regression mode of prediction, mean and sampling are optional.
output_mode (str) – The mode of model output, quantiles and predictions are optional.
optimizer_fn (Callable, Optional) – optimizer algorithm.
optimizer_params (Dict, Optional) – optimizer parameters.
eval_metrics (List[str], Optional) – evaluation metrics of model.
callbacks (List[Callback], Optional) – customized callback functions.
batch_size (int, Optional) – number of samples per batch.
max_epochs (int, Optional) – max epochs during training.
verbose (int, Optional) – verbosity mode.
patience (int, Optional) – number of epochs with no improvement after which learning rate wil be reduced.
seed (int, Optional) – global random seed.