Quant Memo
Core

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 tt, 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:

ht=RNN(ht1,zt1,xt),(μt,σt)=g(ht),ztN(μt,σt2)h_t = \text{RNN}(h_{t-1}, z_{t-1}, x_t), \qquad (\mu_t, \sigma_t) = g(h_t), \qquad z_t \sim \mathcal{N}(\mu_t, \sigma_t^2)

In words: the hidden state hth_t is updated the usual recurrent way from the previous observed value zt1z_{t-1} and any covariates xtx_t (day of week, price, promotions); a small output layer gg turns that hidden state into a mean μt\mu_t and standard deviation σt\sigma_t; and the model is trained to make the observed ztz_t 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 tt, feeds that sample back in as ztz_t for step t+1t+1, 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 tt the model outputs μt=420\mu_t = 420, σt=30\sigma_t = 30 (a Gaussian). The 90% interval is roughly μ±1.645σ=420±49.4\mu \pm 1.645\sigma = 420 \pm 49.4, about [371,469][371, 469]. 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.

μ=420 (point forecast) 90% interval
A point forecast reports only the dot at the mean; DeepAR reports the whole shaded distribution, so a decision-maker can size for the tail, not just the center.

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 t+3t+3 the sorted samples' 10th-smallest is 350 and 90th-smallest is 510, giving an empirical [350,510][350, 510] 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.

Sampling distribution
sample mean →
sample size n 10spread of means 0.332predicted 1/√n 0.316

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

  1. For μ=100\mu = 100, σ=15\sigma = 15, compute the approximate 90% interval using μ±1.645σ\mu \pm 1.645\sigma.
  2. Explain why DeepAR's uncertainty interval typically widens as the forecast horizon increases.
  3. 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)
ShareTwitterLinkedIn