DeepAR Probabilistic Forecasting
DeepAR trains one recurrent network across thousands of related time series at once and outputs a full probability distribution for each future step, not just a single best-guess number.
Prerequisites: Sliding-Window Supervision for Time Series, Quantile (Pinball) Loss for Neural Forecasting
A forecast that outputs a single number — "demand tomorrow is 420 units" — hides the most important piece of information a decision-maker needs: how confident should you be, and what does the range of plausible outcomes actually look like? A single point forecast treats a rock-solid 420±5 the same as a shaky 420±300. DeepAR was built to fix exactly this, and to fix a second, separate problem: most real forecasting jobs involve thousands of related series (every product in a warehouse, every stock in a sector), each with too little individual history to train its own model, but with shared patterns across the group that a single model could learn from all of them at once.
The analogy: a weather forecaster who quotes odds, trained on every city at once
A forecaster who only says "tomorrow will be 72°F" is less useful than one who says "72°F is the most likely outcome, but there's a 90% chance it lands between 68 and 76." The second forecaster is expressing a full probability distribution, not a point guess. Now imagine that same forecaster doesn't train separately for each city — they learn general patterns of how weather behaves (how yesterday's temperature relates to tomorrow's, how humidity interacts with rain) from all cities' histories pooled together, then apply that shared understanding to make a city-specific forecast, even for a city with only a few weeks of recorded history. That's DeepAR: one shared recurrent model, trained across many series, producing a distribution rather than a number for each one.
The mechanics: autoregressive RNN with a distributional output head
At each time step , DeepAR's recurrent network updates its hidden state from the previous observation and outputs the parameters of a chosen probability distribution (commonly Gaussian or negative binomial for count data), rather than a value directly:
In words: the hidden state is updated the usual recurrent way from the previous observed value and any covariates (day of week, price, promotions); a small output layer turns that hidden state into a mean and standard deviation ; and the model is trained to make the observed likely under that predicted distribution, using maximum likelihood rather than squared-error loss. At inference, DeepAR is autoregressive: to forecast multiple steps ahead, it samples a value from its predicted distribution at step , feeds that sample back in as for step , and repeats — generating many such sample paths whose spread across paths becomes the forecast's uncertainty band.
Worked example 1: reading a one-step distributional forecast
Say at step the model outputs , (a Gaussian). The 90% interval is roughly , about . A point forecaster reports only "420." DeepAR reports the same central estimate plus a usable range: a planner staffing for a 95th-percentile surge would size for roughly 469 units, not 420 — a decision the point forecast alone could not support.
Worked example 2: building a multi-step forecast from sampled paths
To forecast 3 steps ahead, DeepAR draws, say, 100 independent sample paths. Suppose at step the sorted samples' 10th-smallest is 350 and 90th-smallest is 510, giving an empirical interval — wider than the one-step interval above. Uncertainty compounds forward because each step's sample feeds the next step's distribution, the same autoregressive compounding behind exposure bias in deterministic sequence models.
Each of DeepAR's sampled future paths is one draw from its predicted distribution at every step; stacking many such draws — exactly what this explorer does for sample means — is how the model turns per-step distributions into a full forecast interval several steps out.
What this means in practice
DeepAR is the workhorse choice wherever a business needs uncertainty-aware forecasts across many related series at once — retail demand, cloud resource usage, cash-flow forecasting across many accounts — because pooling data across series lets it forecast well even for series with short individual histories, something a per-series model cannot do. Its distributional output feeds directly into risk-aware decisions (safety stock, capital buffers) that a point forecast from N-BEATS Interpretable Forecasting cannot support on its own, though N-BEATS often wins on raw point accuracy and interpretability for well-behaved individual series.
DeepAR trains one recurrent model jointly across many related series and outputs a full probability distribution at each step rather than a single number, generating multi-step forecasts by sampling forward autoregressively and using the spread across sampled paths as the uncertainty band.
Practice
- For , , compute the approximate 90% interval using .
- Explain why DeepAR's uncertainty interval typically widens as the forecast horizon increases.
- Why does training across many related series help a series with only 3 weeks of its own history?
The common confusion is treating DeepAR's output distribution as if it came from repeated experiments like a coin flip. It is a model's belief about the future, shaped by the chosen distributional family (Gaussian, negative binomial) and by how well that family actually fits the real data — a poor distributional choice (e.g. assuming Gaussian for data with sharp positive spikes) will produce confident-looking but wrong intervals. Always check the predicted distribution's shape against held-out data before trusting the quoted percentiles for a real decision.
Related concepts
Practice in interviews
Further reading
- Salinas et al., DeepAR: Probabilistic Forecasting with Autoregressive Recurrent Networks (2020)