DeepAR

Machine Learning
Introduced by
Salinas, D., Flunkert, V. & Gasthaus, J. (Amazon)
Year
2020
Type
Autoregressive recurrent neural network (probabilistic forecasting)

What does it do?

DeepAR is Amazon's forecasting model for probabilistic prediction.

Introduced by Salinas, Flunkert, Gasthaus and Januschowski, it trains an autoregressive recurrent neural network that estimates, at each time step, the parameters of a probability distribution, so forecasts take the form of predictive distributions rather than single values. It is designed to model many related time series jointly within one network.

The intuition behind the method

Many classical forecasters fit one model to one series and return a point forecast. DeepAR instead learns one shared recurrent network across many related series at once, so patterns learned on heavily observed series can inform forecasts for sparse or new ones. At every step it outputs the parameters of a probability distribution rather than a single value, so the forecast comes with a predictive distribution from which uncertainty bands can be drawn.

History

DeepAR was developed at Amazon and is described by Salinas, Flunkert, Gasthaus and Januschowski in the International Journal of Forecasting, 36(3), published in 2020.

When to use it

Consider DeepAR for forecasting continuous or count time series when you have a collection of related series and need a full predictive distribution rather than a point value. The likelihood should match the data type: Gaussian for real-valued series, Negative Binomial for counts. DeepAR is built for training on a large number of related series; a single series, or a small collection, gives the shared network little to learn from. For a single short series a classical method such as ARIMA is usually more appropriate, and DeepAR is a poor fit when the dataset is too small to estimate the distribution parameters reliably.

Limitations and considerations

  • Needs a large collection of related series. With few series or short histories the distribution parameters are estimated unreliably, so the calibration of the intervals should be checked.
  • Requires choosing an appropriate probabilistic likelihood up front; a mismatched choice distorts the predictive distribution.
  • Training a neural network by likelihood maximisation involves more setup and tuning effort than fitting a classical forecaster to a single series.
  • On very short series the autoregressive RNN has little history to learn from, and a classical method is generally preferable.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Produces full probabilistic forecasts with prediction intervals, not just point estimates.
  • Models many related time series jointly in one network, so patterns learned on data-rich series can inform series with little history.
  • Lets the likelihood be matched to the data type (for example Gaussian for real-valued series or Negative Binomial for counts), instead of forcing a single distributional form on every series.
  • Requires comparatively little manual per-series model specification, since one shared model is fitted across the collection.

Applications

  • Demand and sales forecasting across many related products or stores.
  • Probabilistic forecasting where uncertainty intervals matter, not just a point estimate.
  • Forecasting sparse or newly launched series by sharing patterns from established ones.
  • Joint modelling of large panels of related continuous time series.

How it works

How it works

1

A single recurrent neural network is trained jointly across a collection of related time series. Because the model is autoregressive, each prediction feeds back as input for the next step, and because it is shared across series it can borrow strength from heavily observed series to forecast ones with little history.

2

At each time step the recurrent network does not emit a number directly; it emits the parameters of a chosen probability distribution, for example Gaussian for real-valued data or Negative Binomial for count data. The network is trained to maximise the likelihood of the observed values under these step-wise distributions.

3

Forecasts are generated by sampling forward from the fitted step-wise distributions, producing many possible future trajectories. Quantiles of these samples give the prediction intervals for each step of the horizon.

Common pitfalls

  • Applying it to a single short series where a classical method such as ARIMA would be more appropriate.
  • Choosing a likelihood that does not match the data (for example Gaussian for count data).
  • Trusting the distribution parameters when the dataset is too small to estimate them reliably.
  • Reporting only the central forecast and ignoring the probabilistic intervals the model provides.
  • Judging probabilistic accuracy only by whether intervals cover the observations; proper scoring rules such as quantile loss or CRPS assess the full predictive distribution.
  • Treating uncertainty as constant across the horizon; because forecasts are built by sampling forward step by step, the spread of the sampled trajectories generally widens as the horizon grows.

Frequently asked questions

How is DeepAR different from ARIMA?

ARIMA fits one model to a single series and returns a point forecast (optionally with intervals from its own assumptions). DeepAR trains one recurrent network jointly across many related series and outputs the parameters of a probability distribution at each step, giving probabilistic forecasts. On a single short series ARIMA is usually the better choice.

How much data does DeepAR need?

DeepAR is designed for large collections of related series, and reliability depends on both the number of series and their length. With few or very short series, a classical method such as ARIMA is usually preferable. Even with a large collection, small samples estimate the distribution parameters less reliably, so check the calibration of the intervals before relying on them.

Which probability distribution should I choose?

Match the likelihood to the data: a Gaussian distribution for real-valued series and a Negative Binomial for count data are the common choices. Picking a mismatched likelihood degrades the forecast.

Is DeepAR hard to train?

Training is more involved than for classical forecasters, because it is a neural network optimised over many series, so plan for additional setup and computation. Hardware needs grow with the number of series, their length and the network size.

Related methods

Sources

  1. Salinas, D., Flunkert, V., Gasthaus, J. & Januschowski, T. (2020). DeepAR: Probabilistic Forecasting with Autoregressive Recurrent Networks. International Journal of Forecasting, 36(3), 1181–1191.

    Open DOI reference
  2. Salinas, D., Flunkert, V. & Gasthaus, J. (2017). DeepAR: Probabilistic Forecasting with Autoregressive Recurrent Networks. arXiv:1704.04110.

    Open publication reference