DeepAR, an autoregressive recurrent network developed by Amazon, is the first model that could natively work on multiple time-series. It’s a milestone in time-series community.

What is DeepAR

Quote

DeepAR is the first successful model to combine Deep Learning with traditional Probabilistic Forecasting.

  • Multiple time-series support
  • Extra covariates: DeepAR allows extra features, covariates. It is very important for me when I learn DeepAR, because in my task, I have corresponding feature for each time series.
  • Probabilistic output:  Instead of making a single prediction, the model leverages quantile loss to output prediction intervals.
  • “Cold” forecasting: By learning from thousands of time-series that potentially share a few similarities, DeepAR can provide forecasts for time-series that have little or no history at all.

Block used in DeepAR

DeepAR Architecture

DeepAR模型并不直接使用LSTMs去计算prediction,而是去估计Gaussian likelihood function的参数,即,估计Gaussian likelihood function的mean和standard deviation。

Training Step-by-Step

假设目前我们在time-series 的 t 时刻,

  1. LSTM cell会输入covariates ,即在t时刻的值,还有上一时刻的target variable,,LSTM还需要输入上一时刻的隐藏状态
  2. LSTM紧接着就会输出当前的hidden state ,会输入到下一步中
  3. Gaussian likelihood function里的parameter,会从中不直接计算出,计算细节在后面

Quote

换言之,这个模型是为了得到最好的去构建gaussian distribution,让预测更接近;同时,因为DeepAR每次都是train and predicts a single data point,所以这个模型也被称为autoregressive模型

Inference Step-by-Step

在使用model进行预测的时候,某一改变的就是使用预测值 代替真实值,同时是在我们模型学习到的Gaussian distribution里sample得到的,而这个Gaussian distribution里的参数并不是model直接学习到的,DeepAR如何做到这一点的呢?

Gaussian Likelihood

Estimate gaussian distribution的任务一般会被转化成maximize gaussian log-likelihood function的任务,即MLEformulas(maximum log-likelihood estimators) Gaussian log-likelihood function:

Parameter estimation in DeepAR

在统计学中,预估Gaussian Distribution一般使用MLEformulas,但是在DeepAR中,并不这么去做,而是使用两个dense layer去做预估,如下图:

使用dense layer的方式去预估Gaussian distribution的原因在于,可以使用backpropagation

Reference