# DWNet: Dual-Window Deep Neural Network for Time Series Prediction

Authors: Jin Fan; Yipan Huang; Ke Zhang; Sen Wang; Jinhua Chen; Baiping Chen
Journal: Complexity
 (2021)

---

## Abstract

Multivariate time series prediction is a very important task, which plays a huge role in climate, economy, and other fields. We usually use an Attention-based Encoder-Decoder network to deal with multivariate time series prediction because the attention mechanism makes it easier for the model to focus on the really important attributes. However, the Encoder-Decoder network has the problem that the longer the length of the sequence is, the worse the prediction accuracy is, which means that the Encoder-Decoder network cannot process long series and therefore cannot obtain detailed historical information. In this paper, we propose a dual-window deep neural network (DWNet) to predict time series. The dual-window mechanism allows the model to mine multigranularity dependencies of time series, such as local information obtained from a short sequence and global information obtained from a long sequence. Our model outperforms nine baseline methods in four different datasets.


---

## Body

## 1. Introduction

In the age of big data, sequence data is everywhere in life [1, 2]. Time series prediction algorithms are becoming more and more important in many areas, such as financial market prediction [3], passenger demand forecasting [4], and heart signal prediction [5]. In most cases, time series data is multivariate. The key to multivariate time series prediction is to obtain the spatial and temporal relationships between different attributes at different times [6]. As a widely used traditional time series prediction algorithm, ARIMA [7] has shown its effectiveness in many areas. However, ARIMA cannot model nonlinear relationships and can only be applied to stationary time series [8–10]. Recurrent neural network (RNN) [11] has achieved great success in sequence modeling. But RNN has the problem of vanishing gradients, and it is difficult to capture the long-term dependence of time series [12]. Long Short-Term memory (LSTM) [13] and gated recurrent unit (GRU) [14, 15] alleviate the problem of RNN’s vanishing gradients and have developed many models for time series prediction, such as Encoder-Decoder networks [15, 16]. Encoder-Decoder networks are excellent in time series prediction tasks, especially Attention-based Encoder-Decoder networks [17]. Attention-based Encoder-Decoder network can not only find the spatial-temporal correlation between different series but also find important information in raw data and increase its weight [17]. Among them, dual-stage attention-based recurrent neural network (DARNN) is one of the state-of-the-art methods, creatively using a two-stage attention mechanism [18].Although DARNN can capture spatial correlations between different attributes at the same time and the temporal correlations between different times in the same attribute, when the length of the sequence is too long, the prediction effect will be worse [18]. This problem is common to all Encoder-Decoder networks. A long sequence means more historical information, so better results should be obtained. However, due to the limitations of Encoder-Decoders, the information of the long sequence is not effectively used, even interfere with the prediction results. This is because LSTM does not solve the problem of vanishing gradient, and when the length of the time series is too long, the previous information will be covered by the latter. Therefore, Encoder-Decoders generally use a small window size to ensure the accuracy of prediction. Dual-stage two-phase attention-based recurrent neural network (DSTP) [19] has made improvements to this problem of DARNN and optimized the prediction effect of long sequences. However, DSTP still does not make effective use of long sequences.When the time window size is small, the series is very close to the prediction point. Such data has the closest relationship with the prediction point. For instance, if the values before the prediction point are gradually increasing, then the value at the prediction point is also likely to increase. When the time window size is large, series contain more time steps. It is difficult for other models to extract recent information, such as trends, in such a long series, so it cannot get good prediction results. However, more information brought by more time steps is very important for time series prediction. It is key to how to make good use of the different characteristics of short sequence and long sequence.To solve this problem, we propose a dual-window deep neural network (DWNet). DWNet consists of two parts. The first part captures spatial and temporal correlations from the short sequence and is responsible for providing recent details, based on Encoder-Decoder [15]. The second part obtains long-term dependencies such as periodicity and seasonality from the long sequence, based on TCN. Temporal convolutional network (TCN) [20] is an emerging CNN-based model. With the parallelism of convolution operation and large receptive field, it has gained everyone’s expectations in the areas of sequence modeling. Short-term time series generally contain only one or two periods. However, long-term time series are the opposite, including enough time steps. The setting of two different time window sizes for long sequence and short sequence makes it possible to mine multigranularity dependencies.The main contributions of our work are as follows:(i)
We propose a dual-window mechanism that can extract multigranularity information from sequences of different lengths.(ii)
We propose the DWNet approach, which includes the advantages of Encoder-Decoder networks and TCN at the same time. Encoder-Decoder networks have a strong ability to mine dependence from the short sequence. Meanwhile, TCN’s large receptive field and fast training speed are more suitable for long sequences.(iii)
DWNet can be applied to time series prediction tasks in many domains, and there is no requirement for input data. To justify the effectiveness of the DWNet, we compare it with nine baseline methods using the Human Sports dataset, SML 2010 dataset, Appliances Energy dataset, and EEG dataset. The experiment showed the effectiveness and robustness of DWNet.


## 2. Related Work

For the time series prediction task, there are various approaches from traditional methods to deep learning methods. As the most famous traditional method, ARIMA can effectively obtain the long-term dependence of target series [7]. However, ARIMA does not consider the spatial correlation between exogenous series [18], can only be used to deal with stationary series [7], and cannot model nonlinear relationships [8]. ARIMA is not suitable for the increasingly complex time series data analysis. As a deep neural network dedicated to machine learning and data mining applications [21–23], RNN can model nonlinear relationships [24] and has achieved great success in time series prediction. However, the gradient vanishing of RNN makes it difficult to obtain long-term dependence from time series. LSTM [13] and GRU [15] add a gating mechanism based on RNN and process the addition and deletion of timing information through the gating mechanism, which alleviates gradient vanishing of RNN. Based on LSTM and GRU, many influential deep neural networks have been proposed, such as the Encoder-Decoder network that has received great attention in the area of natural language processing [17]. Encoder-Decoder networks convert input series into context vector through Encoder and then convert context vector into output through Decoder. Encoder-Decoder networks have a problem. When the length of the sequence increases, the performance of Encoder-Decoder will first become better and then worse [17]. Attention-based Encoder-Decoder network can automatically select important information, thereby effectively alleviating the shortcoming of performance degradation when the length of the sequence increases.Many attention-based models emerge endlessly. And DARNN [18], GeoMAN [25], and DSTP [19] are models that are improved based on the Attention-based Encoder-Decoder and used for time series prediction. Inspired by some theories of human attention [26], DARNN uses a dual-stage attention mechanism. The first stage uses a spatial attention mechanism to assign different weights to exogenous series to the hidden state of Encoder at the previous time step. The second stage uses a temporal attention mechanism to select the most relevant Decoder hidden states in all time steps. After DARNN was proposed, it has always been one of the state-of-the-art methods in time series prediction. Multilevel Attention Network (GeoMAN) is specially used to predict geo-sensor time series data. Many time series data are collected by sensors distributed in many locations. Such data is called geo-sensor time series data. If each series in the geo-sensor time series is simply treated as a normal attribute, it will lose the connection between different locations. GeoMAN adds local spatial attention and global attention mechanisms to Encoder and adds external factor information to Decoder to solve this problem. DSTP adds a new spatial attention mechanism to Encoder to obtain a spatial correlation between target series and exogenous series so that DSTP achieved better results in the long time series prediction.While the Attention-based Encoder-Decoder network has attracted much attention, TCN has also shown strong sequence modeling ability [20]. TCN is based on CNN and includes causal convolution, dilated convolution [27, 28], and residual block [29]. To apply to series data, TCN is specially adjusted for different data formats of series and image. TCN has advantages that RNNs do not have. (1) TCN can process series in parallel and does not need to be processed sequentially like RNN or LSTM. This means that there is no possibility that the information of the previous time step will be overwritten and it also means that there is a faster training speed. (2) TCN’s receptive field varies with the number of layers, kernel size, and dilation rate and can be flexibly changed according to a different situation. (3) Compared with LSTM, TCN rarely has the problem of gradient vanishing. Due to the flexible receptive field, fewer parameters than LSTM, and parallel processing, TCN can not only reduce the training time of long sequence but also ensure that the information of the previous time step will not be covered. Therefore, TCN has a strong ability to obtain information from long sequences and is suitable for long sequence modeling.Long- and short-term time series network (LSTNet) [30] is based on CNN and RNN and realizes that time series have two different dependencies, short-term and long-term. Therefore, LSTNet uses a recurrent-skip mechanism to obtain short-term dependence and then uses RNN to obtain long-term dependence from previous results. But it does not consider that the closer to the prediction point, the more important the information. Therefore, LSTNet will lose some recent information in the time series prediction.


## 3. Dual-Window Deep Neural Network

### 3.1. Notation and Problem Statement

In our work, there are two different window sizes,Tl and Ts. Given n exogenous series, that is, X=X1=xl1,xl2,…,xln⊤=x1,x2,…,xTl∈ℝn×Tl, we segmented a short series like this X2=xs1,xs2,…,xsn⊤=xTl−Ts+1,xTl−Ts+2,…,xTl∈ℝn×Ts. We use xli=x1i,x2i,…,xTli⊤∈ℝTl to represent the i-th long exogenous series, use xsi=xTl−Ts+1i,xTl−Ts+2i,…,xTli⊤∈ℝTs to represent the i-th short exogenous series, and use xt=xt1,xt2,…,xtn⊤∈ℝn to denote a vector of n exogenous series at time t. We use Y=y1,y2,…,yTl⊤∈ℝTl to represent target series, which has the long window size Tl.Given previous values of target series and exogenous series, that is,y1,y2,…,yTl with yt∈ℝ and x1,x2,…,xTl with xt∈ℝn, we aim to predict the next time step value of target series yT+1:(1)y^Tl+1=Fy1,…,yTl,x1,…,xTl,where F. is a nonlinear mapping function we aim to learn.


### 3.2. Model

Figure1 presents the framework of our method. The input of DWNet is divided into two parts, long series with window size Tl and short series with window size Ts. Short series is a part of long series and is located at the end of the long series (Figure 1 shows the relationship between the two series). Long series is processed by TCN [20] and used to obtain more detailed historical information than short series. The short series is processed by Encoder-Decoder to capture local information. Finally, the output of the two parts is combined to get the predicted value of the target series at time Tl+1.Figure 1
Framework of our method.Tl: the window size of long series. Ts: the window size of short series. n: the number of exogenous series. xli: i-th long exogenous series. ht: hidden state in the encoder at time t. ht′: hidden state in the decoder at time t. Spatial Attn: spatial attention module. Temporal Attn: temporal attention module. y^Tl+1: the predicting value at time Tl+1.


#### 3.2.1. Capture Short-Term Dependence

First of all, we introduce the short series processing module. This part is based on Encoder-Decoder and uses spatial attention and temporal attention mechanism [18] to emphasize key information in short series. Encoder is based on LSTM, the input data of Encoder is short series X2=xTl−Ts+1,xTl−Ts+2,…,xTl∈ℝn×Ts. Given i-th short exogenous series xsi=xTl−Ts+1i,xTl−Ts+2i,…,xTli⊤∈ℝTs, we use the spatial attention module to adaptively obtain the spatial correlation between exogenous series:(2)eti=ve⊤tanhWeht−1:st−1+Uexi+be,(3)αti=expeti∑j=1nexpetj,where ve∈ℝTs,We∈ℝTs×2p,Ue∈ℝTs×Ts, and be∈ℝTs are parameters to learn. Here, p is the hidden size of Encoder and ht−1∈ℝp and st−1∈ℝp are the hidden state and cell state of LSTM unit in the Encoder at time t−1. αti is the attention weight measuring the importance of i-th exogenous series at time t. After we get the attention weight, we can adaptively extract exogenous series with(4)x˜t=αt1xt1,αt2xt2,…,αtnxtn⊤.Thus, the hidden state at timet can be updated as(5)ht=feht−1,x˜t,where fe is an LSTM unit in the Encoder. The spatial attention module calculates the weight of each exogenous series through equations (2) and (3) at time t and uses x˜t to adjust the hidden state at time t.The input of Decoder is the previous target series and the output of the Encoder, which is the hidden state of Encoder. Decoder aims to predicty^Tl+1. To get accurate prediction results, we need to capture the temporal correlation between each series. So, we add a temporal attention module to the Decoder. The same as Encoder, the attention weight of Encoder hidden state at time t is calculated based upon the previous Decoder hidden state and cell state of LSTM unit with(6)dti=vd⊤tanhWdht−1′:st−1′+Udhi+bd(7)βti=expdti∑j=1Tsexpdtj,where vd⊤∈ℝp,Wd∈ℝp×2q,Ud∈ℝp×p, and bd∈ℝp are parameters to learn. q is the hidden size of Decoder, and ht−1′∈ℝn and st−1′∈ℝn are the hidden state and cell state of LSTM unit in the Decoder at time t−1. βti is the attention weight and can show the importance of i-th Decoder hidden state at time t−1. And, we can get context vector with(8)ct=∑i=1Tsβtihi.Context vectorct is the sum of all weighted encoder hidden states at time t. Then, we combine context vector ct and target series to update the Decoder hidden state ht′:(9)ht′=fdht−1′,ct:yt,where fd is an LSTM unit in the Decoder.


#### 3.2.2. Capture Long-Term Dependence

We obtain long-term dependence through TCN [20], because TCN can process time series data in parallel and have much fewer parameters than LSTM. Therefore, TCN can quickly handle long series and improve time efficiency. And TCN does not have the problem of the previous information being covered. When window sizes are too large, the integrity of the information can be guaranteed. In our model, the input of the TCN part is long series from time 1 to Tl. In time series analysis, we cannot allow leakage from the future into the past. A high layer element at time t is obtained by convolution of elements from time t and earlier in the previous layer. To avoid information leakage, TCN uses casual convolution. To expand the receptive field, TCN uses dilated convolution [27, 28]. For long exogenous series X1=x1,x2,…,xTl∈ℝn×Tl and filter g:g0,g1,…,gk−1, the element at time t is(10)Ot=x∗dgt=∑i=0k−1gixt−d·i,where d is the dilation factor, k is the filter size, and O is dilated convolution operation. d will increase exponentially with the number of layers to expand the receptive field. A deep neural network is so easy to have the problem of gradient exploding and gradient vanishing, so TCN uses residual block [29]. The residual connection enables the network to transfer information in a cross layer and improve the efficiency of feature extraction.


#### 3.2.3. Training

Figure1 shows that the predicted value is determined by two parts. We combine the output of Decoder hTs′ and TCN OTl to predict y^Tl+1:(11)y^Tl+1=Fy1,…,yTl,x1,…,xTl=vy⊤WyhTs′:OTl+bw+bv,where vy∈ℝq,Wy∈ℝq×q+m,bw∈ℝq, and bv∈ℝ are parameters to learn. Here, m is the number of hidden units per layer, and hTs′:OTl∈ℝq+m. We use the backpropagation algorithm to train DWNet. We use the Adam optimizer [31] to minimize the mean squared error (MSE) between the predicted value y^Tl+1 and the ground truth yTl+1:(12)Lθ=y^Tl+1−yTl+122,where θ are all parameters to learn in DWNet.


## 3.1. Notation and Problem Statement

In our work, there are two different window sizes,Tl and Ts. Given n exogenous series, that is, X=X1=xl1,xl2,…,xln⊤=x1,x2,…,xTl∈ℝn×Tl, we segmented a short series like this X2=xs1,xs2,…,xsn⊤=xTl−Ts+1,xTl−Ts+2,…,xTl∈ℝn×Ts. We use xli=x1i,x2i,…,xTli⊤∈ℝTl to represent the i-th long exogenous series, use xsi=xTl−Ts+1i,xTl−Ts+2i,…,xTli⊤∈ℝTs to represent the i-th short exogenous series, and use xt=xt1,xt2,…,xtn⊤∈ℝn to denote a vector of n exogenous series at time t. We use Y=y1,y2,…,yTl⊤∈ℝTl to represent target series, which has the long window size Tl.Given previous values of target series and exogenous series, that is,y1,y2,…,yTl with yt∈ℝ and x1,x2,…,xTl with xt∈ℝn, we aim to predict the next time step value of target series yT+1:(1)y^Tl+1=Fy1,…,yTl,x1,…,xTl,where F. is a nonlinear mapping function we aim to learn.


## 3.2. Model

Figure1 presents the framework of our method. The input of DWNet is divided into two parts, long series with window size Tl and short series with window size Ts. Short series is a part of long series and is located at the end of the long series (Figure 1 shows the relationship between the two series). Long series is processed by TCN [20] and used to obtain more detailed historical information than short series. The short series is processed by Encoder-Decoder to capture local information. Finally, the output of the two parts is combined to get the predicted value of the target series at time Tl+1.Figure 1
Framework of our method.Tl: the window size of long series. Ts: the window size of short series. n: the number of exogenous series. xli: i-th long exogenous series. ht: hidden state in the encoder at time t. ht′: hidden state in the decoder at time t. Spatial Attn: spatial attention module. Temporal Attn: temporal attention module. y^Tl+1: the predicting value at time Tl+1.


### 3.2.1. Capture Short-Term Dependence

First of all, we introduce the short series processing module. This part is based on Encoder-Decoder and uses spatial attention and temporal attention mechanism [18] to emphasize key information in short series. Encoder is based on LSTM, the input data of Encoder is short series X2=xTl−Ts+1,xTl−Ts+2,…,xTl∈ℝn×Ts. Given i-th short exogenous series xsi=xTl−Ts+1i,xTl−Ts+2i,…,xTli⊤∈ℝTs, we use the spatial attention module to adaptively obtain the spatial correlation between exogenous series:(2)eti=ve⊤tanhWeht−1:st−1+Uexi+be,(3)αti=expeti∑j=1nexpetj,where ve∈ℝTs,We∈ℝTs×2p,Ue∈ℝTs×Ts, and be∈ℝTs are parameters to learn. Here, p is the hidden size of Encoder and ht−1∈ℝp and st−1∈ℝp are the hidden state and cell state of LSTM unit in the Encoder at time t−1. αti is the attention weight measuring the importance of i-th exogenous series at time t. After we get the attention weight, we can adaptively extract exogenous series with(4)x˜t=αt1xt1,αt2xt2,…,αtnxtn⊤.Thus, the hidden state at timet can be updated as(5)ht=feht−1,x˜t,where fe is an LSTM unit in the Encoder. The spatial attention module calculates the weight of each exogenous series through equations (2) and (3) at time t and uses x˜t to adjust the hidden state at time t.The input of Decoder is the previous target series and the output of the Encoder, which is the hidden state of Encoder. Decoder aims to predicty^Tl+1. To get accurate prediction results, we need to capture the temporal correlation between each series. So, we add a temporal attention module to the Decoder. The same as Encoder, the attention weight of Encoder hidden state at time t is calculated based upon the previous Decoder hidden state and cell state of LSTM unit with(6)dti=vd⊤tanhWdht−1′:st−1′+Udhi+bd(7)βti=expdti∑j=1Tsexpdtj,where vd⊤∈ℝp,Wd∈ℝp×2q,Ud∈ℝp×p, and bd∈ℝp are parameters to learn. q is the hidden size of Decoder, and ht−1′∈ℝn and st−1′∈ℝn are the hidden state and cell state of LSTM unit in the Decoder at time t−1. βti is the attention weight and can show the importance of i-th Decoder hidden state at time t−1. And, we can get context vector with(8)ct=∑i=1Tsβtihi.Context vectorct is the sum of all weighted encoder hidden states at time t. Then, we combine context vector ct and target series to update the Decoder hidden state ht′:(9)ht′=fdht−1′,ct:yt,where fd is an LSTM unit in the Decoder.


### 3.2.2. Capture Long-Term Dependence

We obtain long-term dependence through TCN [20], because TCN can process time series data in parallel and have much fewer parameters than LSTM. Therefore, TCN can quickly handle long series and improve time efficiency. And TCN does not have the problem of the previous information being covered. When window sizes are too large, the integrity of the information can be guaranteed. In our model, the input of the TCN part is long series from time 1 to Tl. In time series analysis, we cannot allow leakage from the future into the past. A high layer element at time t is obtained by convolution of elements from time t and earlier in the previous layer. To avoid information leakage, TCN uses casual convolution. To expand the receptive field, TCN uses dilated convolution [27, 28]. For long exogenous series X1=x1,x2,…,xTl∈ℝn×Tl and filter g:g0,g1,…,gk−1, the element at time t is(10)Ot=x∗dgt=∑i=0k−1gixt−d·i,where d is the dilation factor, k is the filter size, and O is dilated convolution operation. d will increase exponentially with the number of layers to expand the receptive field. A deep neural network is so easy to have the problem of gradient exploding and gradient vanishing, so TCN uses residual block [29]. The residual connection enables the network to transfer information in a cross layer and improve the efficiency of feature extraction.


### 3.2.3. Training

Figure1 shows that the predicted value is determined by two parts. We combine the output of Decoder hTs′ and TCN OTl to predict y^Tl+1:(11)y^Tl+1=Fy1,…,yTl,x1,…,xTl=vy⊤WyhTs′:OTl+bw+bv,where vy∈ℝq,Wy∈ℝq×q+m,bw∈ℝq, and bv∈ℝ are parameters to learn. Here, m is the number of hidden units per layer, and hTs′:OTl∈ℝq+m. We use the backpropagation algorithm to train DWNet. We use the Adam optimizer [31] to minimize the mean squared error (MSE) between the predicted value y^Tl+1 and the ground truth yTl+1:(12)Lθ=y^Tl+1−yTl+122,where θ are all parameters to learn in DWNet.


## 3.2.1. Capture Short-Term Dependence

First of all, we introduce the short series processing module. This part is based on Encoder-Decoder and uses spatial attention and temporal attention mechanism [18] to emphasize key information in short series. Encoder is based on LSTM, the input data of Encoder is short series X2=xTl−Ts+1,xTl−Ts+2,…,xTl∈ℝn×Ts. Given i-th short exogenous series xsi=xTl−Ts+1i,xTl−Ts+2i,…,xTli⊤∈ℝTs, we use the spatial attention module to adaptively obtain the spatial correlation between exogenous series:(2)eti=ve⊤tanhWeht−1:st−1+Uexi+be,(3)αti=expeti∑j=1nexpetj,where ve∈ℝTs,We∈ℝTs×2p,Ue∈ℝTs×Ts, and be∈ℝTs are parameters to learn. Here, p is the hidden size of Encoder and ht−1∈ℝp and st−1∈ℝp are the hidden state and cell state of LSTM unit in the Encoder at time t−1. αti is the attention weight measuring the importance of i-th exogenous series at time t. After we get the attention weight, we can adaptively extract exogenous series with(4)x˜t=αt1xt1,αt2xt2,…,αtnxtn⊤.Thus, the hidden state at timet can be updated as(5)ht=feht−1,x˜t,where fe is an LSTM unit in the Encoder. The spatial attention module calculates the weight of each exogenous series through equations (2) and (3) at time t and uses x˜t to adjust the hidden state at time t.The input of Decoder is the previous target series and the output of the Encoder, which is the hidden state of Encoder. Decoder aims to predicty^Tl+1. To get accurate prediction results, we need to capture the temporal correlation between each series. So, we add a temporal attention module to the Decoder. The same as Encoder, the attention weight of Encoder hidden state at time t is calculated based upon the previous Decoder hidden state and cell state of LSTM unit with(6)dti=vd⊤tanhWdht−1′:st−1′+Udhi+bd(7)βti=expdti∑j=1Tsexpdtj,where vd⊤∈ℝp,Wd∈ℝp×2q,Ud∈ℝp×p, and bd∈ℝp are parameters to learn. q is the hidden size of Decoder, and ht−1′∈ℝn and st−1′∈ℝn are the hidden state and cell state of LSTM unit in the Decoder at time t−1. βti is the attention weight and can show the importance of i-th Decoder hidden state at time t−1. And, we can get context vector with(8)ct=∑i=1Tsβtihi.Context vectorct is the sum of all weighted encoder hidden states at time t. Then, we combine context vector ct and target series to update the Decoder hidden state ht′:(9)ht′=fdht−1′,ct:yt,where fd is an LSTM unit in the Decoder.


## 3.2.2. Capture Long-Term Dependence

We obtain long-term dependence through TCN [20], because TCN can process time series data in parallel and have much fewer parameters than LSTM. Therefore, TCN can quickly handle long series and improve time efficiency. And TCN does not have the problem of the previous information being covered. When window sizes are too large, the integrity of the information can be guaranteed. In our model, the input of the TCN part is long series from time 1 to Tl. In time series analysis, we cannot allow leakage from the future into the past. A high layer element at time t is obtained by convolution of elements from time t and earlier in the previous layer. To avoid information leakage, TCN uses casual convolution. To expand the receptive field, TCN uses dilated convolution [27, 28]. For long exogenous series X1=x1,x2,…,xTl∈ℝn×Tl and filter g:g0,g1,…,gk−1, the element at time t is(10)Ot=x∗dgt=∑i=0k−1gixt−d·i,where d is the dilation factor, k is the filter size, and O is dilated convolution operation. d will increase exponentially with the number of layers to expand the receptive field. A deep neural network is so easy to have the problem of gradient exploding and gradient vanishing, so TCN uses residual block [29]. The residual connection enables the network to transfer information in a cross layer and improve the efficiency of feature extraction.


## 3.2.3. Training

Figure1 shows that the predicted value is determined by two parts. We combine the output of Decoder hTs′ and TCN OTl to predict y^Tl+1:(11)y^Tl+1=Fy1,…,yTl,x1,…,xTl=vy⊤WyhTs′:OTl+bw+bv,where vy∈ℝq,Wy∈ℝq×q+m,bw∈ℝq, and bv∈ℝ are parameters to learn. Here, m is the number of hidden units per layer, and hTs′:OTl∈ℝq+m. We use the backpropagation algorithm to train DWNet. We use the Adam optimizer [31] to minimize the mean squared error (MSE) between the predicted value y^Tl+1 and the ground truth yTl+1:(12)Lθ=y^Tl+1−yTl+122,where θ are all parameters to learn in DWNet.


## 4. Experiment

Our model and all baseline methods are implemented on the PyTorch framework [32]. In this section, we first introduce four different datasets used in the experiment. Then, we introduce nine baseline methods. Next, we introduce the model evaluation methods and parameters. Finally, experiment results show the effectiveness of DWNet.


### 4.1. Datasets

We use four datasets to verify the effect of our model. They are in the field of sports, energy, climate, and medicine. We divide datasets into training sets and testing sets according to the ratio of 4 : 1.


#### 4.1.1. Human Sports [33]

Human Sports data is collected by 10 volunteers of different genders, heights, and weights who performed sports including squat, walking, jumping jacks, and high knee. Four sensors worn on the arms and thighs record data every 50 milliseconds, including acceleration and angular acceleration of thex-axis, y-axis, and z-axis. In our experiment, we take the resultant acceleration as the target series and others as exogenous series. We only use the squat data of one volunteer and use the first 8796 data points as the training set and the remaining 2197 data points as the testing set.


#### 4.1.2. SML 2010 [34]

SML 2010 is a public dataset for indoor temperature prediction. SML 2010 contains nearly 40 days of data, which is collected by the monitoring system. The data were sampled every minute, computing and uploading it smoothed with 15-minute means. In our experiment, we take the weather temperature as target series and select fifteen exogenous series. We use the first 1971 data points as the training set and the remaining 493 data points as testing set.


#### 4.1.3. Appliances Energy [35]

Appliances energy is a public dataset used for home appliance energy consumption prediction. This dataset is at 10 minutes for about 4.5 months. Room temperature and humidity conditions were monitored with a wireless sensor network. The energy data is recorded with m-bus energy meters every 10 minutes. Weather data was downloaded from the nearest airport weather station. In our experiment, we take energy use as target series and others as exogenous series. We use the first 15548 data points as a training set and the remaining 3887 as a testing set.


#### 4.1.4. EEG [36]

EEG is a public dataset for classification and regression. This database consists of 30 subjects performing Brain–Computer Interface for Steady-State Visual Evoked Potentials. In our experiment, we only use the data from one of those subjects. We take the electrode O1 attribute as the target series and others as exogenous series. We use the first 7542 data points as a training set and the remaining 1886 as a testing set.


### 4.2. Baseline

#### 4.2.1. ARIMA [8]

It is one of the well-known statistical algorithms for time series prediction.


#### 4.2.2. LSTM [13]

LSTM is improved by RNN, through the gating mechanism to control the adding and deletion of information, alleviating the gradient vanishing.


#### 4.2.3. Encoder-Decoder [16]

It is widely used in machine translation. However, Encoder-Decoder has the disadvantage of losing information.


#### 4.2.4. Input-Attn-RNN [18]

It adds a spatial attention module on the basis of Encoder-Decoder to the Encoder to obtain the spatial correlation of raw data.


#### 4.2.5. Temp-Attn-RNN [19]

It adds a temporal attention module on the basis of Encoder-Decoder to the Decoder to obtain the temporal correlation of Encoder hidden state.


#### 4.2.6. TCN [20]

It is an emerging sequence modeling model that has attracted much attention, including casual convolution, dilated convolution, and residual blocks.


#### 4.2.7. LSTNet [30]

It combines CNN and RNN to obtain short-term and long-term dependencies in sequence.


#### 4.2.8. DARNN [18]

As one of the state-of-the-art methods, inspired by the human attention system, DARNN uses both spatial attention and temporal attention to extract spatial-temporal correlation.


#### 4.2.9. DSTP-RNN [19]

It improves DARNN and adds an attention module to Encoder. In the Encoder, more stationary weights can be obtained. DSTP-RNN is good at long time series prediction.


### 4.3. Evaluation Metrics

We employ root mean squared error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE), and symmetric mean absolute percentage error (SMAPE) to evaluate our model and baseline methods. These four evaluation metrics are scale-independent and widely used in time series prediction. RMSE has a strong feedback ability for predicted results that deviate too much from the ground truth. MAE treats all results equally. MAPE is able to compare forecast accuracy among differently scaled time series data because relative errors do not depend on the scale of the dependent variable. However, when truth valueyt is small, different y^t will have a huge difference in MAPE value. And SMAPE can solve this problem. Assuming y^t is predicted value at time t and yt is the ground truth, RMSE is defined as follows:(13)RMSE=1N∑t=1Ny^t−yt2.MAE is defined as follows:(14)MAE=1N∑t=1Ny^t−yt.MAPE is defined as follows:(15)MAPE=100%N∑t=1Ny^t−ytyt.SMAPE is defined as follows:(16)SMAPE=100%N∑t=1Ny^t−yty^t+yt/2.


### 4.4. Parameters Settings

Most time series prediction models have chosen a small window size in their experiment. For example, DARNN set the window size to 10 [18], and GeoMAN set the window size to 6 [25]. To show the influence of window size on prediction, we select the window size T=2,4,8,16,32,128. For DWNet, we set Tl=128 and Ts=16. For baseline methods, we conducted experiments on T=16 and T=128, respectively. In training, we set the batch size to 128 and learning rate to 0.001. In our model, there are also parameters such as the hidden size of Encoder p, the hidden size of Decoder q, kernel size, and levels of TCN. For simplicity, we use the same hidden size at Encoder and Decoder, that is, p=q, and conducted a grid search over 16,32,64,128,256. For TCN level and kernel size, we also conducted a grid search. The setting in which p=q=128,level=8,kernelsize=7 outperforms the others in the testing set. And we fixed these parameters in all experiments.


## 4.1. Datasets

We use four datasets to verify the effect of our model. They are in the field of sports, energy, climate, and medicine. We divide datasets into training sets and testing sets according to the ratio of 4 : 1.


### 4.1.1. Human Sports [33]

Human Sports data is collected by 10 volunteers of different genders, heights, and weights who performed sports including squat, walking, jumping jacks, and high knee. Four sensors worn on the arms and thighs record data every 50 milliseconds, including acceleration and angular acceleration of thex-axis, y-axis, and z-axis. In our experiment, we take the resultant acceleration as the target series and others as exogenous series. We only use the squat data of one volunteer and use the first 8796 data points as the training set and the remaining 2197 data points as the testing set.


### 4.1.2. SML 2010 [34]

SML 2010 is a public dataset for indoor temperature prediction. SML 2010 contains nearly 40 days of data, which is collected by the monitoring system. The data were sampled every minute, computing and uploading it smoothed with 15-minute means. In our experiment, we take the weather temperature as target series and select fifteen exogenous series. We use the first 1971 data points as the training set and the remaining 493 data points as testing set.


### 4.1.3. Appliances Energy [35]

Appliances energy is a public dataset used for home appliance energy consumption prediction. This dataset is at 10 minutes for about 4.5 months. Room temperature and humidity conditions were monitored with a wireless sensor network. The energy data is recorded with m-bus energy meters every 10 minutes. Weather data was downloaded from the nearest airport weather station. In our experiment, we take energy use as target series and others as exogenous series. We use the first 15548 data points as a training set and the remaining 3887 as a testing set.


### 4.1.4. EEG [36]

EEG is a public dataset for classification and regression. This database consists of 30 subjects performing Brain–Computer Interface for Steady-State Visual Evoked Potentials. In our experiment, we only use the data from one of those subjects. We take the electrode O1 attribute as the target series and others as exogenous series. We use the first 7542 data points as a training set and the remaining 1886 as a testing set.


## 4.1.1. Human Sports [33]

Human Sports data is collected by 10 volunteers of different genders, heights, and weights who performed sports including squat, walking, jumping jacks, and high knee. Four sensors worn on the arms and thighs record data every 50 milliseconds, including acceleration and angular acceleration of thex-axis, y-axis, and z-axis. In our experiment, we take the resultant acceleration as the target series and others as exogenous series. We only use the squat data of one volunteer and use the first 8796 data points as the training set and the remaining 2197 data points as the testing set.


## 4.1.2. SML 2010 [34]

SML 2010 is a public dataset for indoor temperature prediction. SML 2010 contains nearly 40 days of data, which is collected by the monitoring system. The data were sampled every minute, computing and uploading it smoothed with 15-minute means. In our experiment, we take the weather temperature as target series and select fifteen exogenous series. We use the first 1971 data points as the training set and the remaining 493 data points as testing set.


## 4.1.3. Appliances Energy [35]

Appliances energy is a public dataset used for home appliance energy consumption prediction. This dataset is at 10 minutes for about 4.5 months. Room temperature and humidity conditions were monitored with a wireless sensor network. The energy data is recorded with m-bus energy meters every 10 minutes. Weather data was downloaded from the nearest airport weather station. In our experiment, we take energy use as target series and others as exogenous series. We use the first 15548 data points as a training set and the remaining 3887 as a testing set.


## 4.1.4. EEG [36]

EEG is a public dataset for classification and regression. This database consists of 30 subjects performing Brain–Computer Interface for Steady-State Visual Evoked Potentials. In our experiment, we only use the data from one of those subjects. We take the electrode O1 attribute as the target series and others as exogenous series. We use the first 7542 data points as a training set and the remaining 1886 as a testing set.


## 4.2. Baseline

### 4.2.1. ARIMA [8]

It is one of the well-known statistical algorithms for time series prediction.


### 4.2.2. LSTM [13]

LSTM is improved by RNN, through the gating mechanism to control the adding and deletion of information, alleviating the gradient vanishing.


### 4.2.3. Encoder-Decoder [16]

It is widely used in machine translation. However, Encoder-Decoder has the disadvantage of losing information.


### 4.2.4. Input-Attn-RNN [18]

It adds a spatial attention module on the basis of Encoder-Decoder to the Encoder to obtain the spatial correlation of raw data.


### 4.2.5. Temp-Attn-RNN [19]

It adds a temporal attention module on the basis of Encoder-Decoder to the Decoder to obtain the temporal correlation of Encoder hidden state.


### 4.2.6. TCN [20]

It is an emerging sequence modeling model that has attracted much attention, including casual convolution, dilated convolution, and residual blocks.


### 4.2.7. LSTNet [30]

It combines CNN and RNN to obtain short-term and long-term dependencies in sequence.


### 4.2.8. DARNN [18]

As one of the state-of-the-art methods, inspired by the human attention system, DARNN uses both spatial attention and temporal attention to extract spatial-temporal correlation.


### 4.2.9. DSTP-RNN [19]

It improves DARNN and adds an attention module to Encoder. In the Encoder, more stationary weights can be obtained. DSTP-RNN is good at long time series prediction.


## 4.2.1. ARIMA [8]

It is one of the well-known statistical algorithms for time series prediction.


## 4.2.2. LSTM [13]

LSTM is improved by RNN, through the gating mechanism to control the adding and deletion of information, alleviating the gradient vanishing.


## 4.2.3. Encoder-Decoder [16]

It is widely used in machine translation. However, Encoder-Decoder has the disadvantage of losing information.


## 4.2.4. Input-Attn-RNN [18]

It adds a spatial attention module on the basis of Encoder-Decoder to the Encoder to obtain the spatial correlation of raw data.


## 4.2.5. Temp-Attn-RNN [19]

It adds a temporal attention module on the basis of Encoder-Decoder to the Decoder to obtain the temporal correlation of Encoder hidden state.


## 4.2.6. TCN [20]

It is an emerging sequence modeling model that has attracted much attention, including casual convolution, dilated convolution, and residual blocks.


## 4.2.7. LSTNet [30]

It combines CNN and RNN to obtain short-term and long-term dependencies in sequence.


## 4.2.8. DARNN [18]

As one of the state-of-the-art methods, inspired by the human attention system, DARNN uses both spatial attention and temporal attention to extract spatial-temporal correlation.


## 4.2.9. DSTP-RNN [19]

It improves DARNN and adds an attention module to Encoder. In the Encoder, more stationary weights can be obtained. DSTP-RNN is good at long time series prediction.


## 4.3. Evaluation Metrics

We employ root mean squared error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE), and symmetric mean absolute percentage error (SMAPE) to evaluate our model and baseline methods. These four evaluation metrics are scale-independent and widely used in time series prediction. RMSE has a strong feedback ability for predicted results that deviate too much from the ground truth. MAE treats all results equally. MAPE is able to compare forecast accuracy among differently scaled time series data because relative errors do not depend on the scale of the dependent variable. However, when truth valueyt is small, different y^t will have a huge difference in MAPE value. And SMAPE can solve this problem. Assuming y^t is predicted value at time t and yt is the ground truth, RMSE is defined as follows:(13)RMSE=1N∑t=1Ny^t−yt2.MAE is defined as follows:(14)MAE=1N∑t=1Ny^t−yt.MAPE is defined as follows:(15)MAPE=100%N∑t=1Ny^t−ytyt.SMAPE is defined as follows:(16)SMAPE=100%N∑t=1Ny^t−yty^t+yt/2.


## 4.4. Parameters Settings

Most time series prediction models have chosen a small window size in their experiment. For example, DARNN set the window size to 10 [18], and GeoMAN set the window size to 6 [25]. To show the influence of window size on prediction, we select the window size T=2,4,8,16,32,128. For DWNet, we set Tl=128 and Ts=16. For baseline methods, we conducted experiments on T=16 and T=128, respectively. In training, we set the batch size to 128 and learning rate to 0.001. In our model, there are also parameters such as the hidden size of Encoder p, the hidden size of Decoder q, kernel size, and levels of TCN. For simplicity, we use the same hidden size at Encoder and Decoder, that is, p=q, and conducted a grid search over 16,32,64,128,256. For TCN level and kernel size, we also conducted a grid search. The setting in which p=q=128,level=8,kernelsize=7 outperforms the others in the testing set. And we fixed these parameters in all experiments.


## 5. Results and Discussion

In this section, we first compare our model with baseline methods on the four datasets. Then, we conduct a grid search to show the performance of our model in different long time steps and short time steps combinations. Next, we investigate ablation experiments and study the time efficiency of our model.


### 5.1. Model Comparison

To show the effectiveness of DWNet, we compare DWNet with 9 different methods, including the state-of-the-art methods and emerging methods. For the sake of fairness, we use two different window sizes for baseline methods so that we can compare the baselines’ results of long window size and short window size with DWNet. The prediction results of DWNet and baseline methods are shown in Tables1 and 2 .Table 1
RMSE and MAE performance comparison among different methods and datasets (best result is displayed inboldface).
ModelsSML 2010Human SportsEEGEnergyRMSEMAERMSEMAERMSEMAERMSEMAEARIMA (16)0.27860.22190.13710.06170.56940.47240.86400.5740LSTM (16)0.19050.14890.08310.03250.22440.17240.69070.3663LSTM (128)0.20990.16710.09830.04370.30330.22830.80170.4376Encoder-Decoder (16)0.14380.09070.07740.02960.24990.14010.59830.2839Encoder-Decoder (128)0.16480.10120.08310.03030.46500.30360.65240.3117Input-Attn-RNN (16)0.12960.07620.06800.02820.20550.14470.54520.2564Input-Attn-RNN (128)0.10080.08970.07660.03620.42170.28810.57820.2502Temp-Attn-RNN (16)0.10970.06920.06460.03110.22200.15000.54140.2507Temp-Attn-RNN (128)0.11050.07700.07400.03340.39430.29980.54880.2563TCN (16)0.11560.08170.06280.02701.18450.95450.82790.5186TCN (128)0.14730.11360.07270.03291.10500.86960.81260.4567LSTNet (16)0.12770.09570.05820.02690.23220.18070.57330.2762LSTNet (128)0.13520.10200.06420.03120.23840.18680.60780.3296DARNN (16)0.09770.06440.06430.02320.18040.14420.52700.2439DARNN (128)0.10930.07780.07330.04350.34830.32500.55560.2525DSTP (16)0.09320.06140.06410.02270.18050.14140.53200.2459DSTP (128)0.09540.06700.06410.02350.17540.13840.54560.2525DWNet0.08910.05650.05750.02170.17020.13710.50150.2362The window size of baseline methods is set to 16 and 128, and the short window size and long window size of DWNet are set to 16 and 128, respectively.Table 2
MAPE and SMAPE performance comparison among different methods and datasets (best result is displayed inboldface).
ModelsSML 2010Human SportsEEGEnergyMAPE (%)SMAPE (%)MAPE (%)SMAPE (%)MAPE (%)SMAPE (%)MAPE (%)SMAPE (%)ARIMA (16)123.099362.009822.350718.4392159.634883.7905178.436577.4287LSTM (16)78.909545.008217.443913.980380.342756.9819163.984965.8066LSTM (128)83.102149.543917.903512.003387.560963.5271176.341569.5442Encoder-Decoder (16)70.714243.076013.33269.561066.463538.5606170.086369.3110Encoder-Decoder (128)78.998150.502215.798710.092379.344540.2327181.758376.1764Input-Attn-RNN (16)61.112130.099711.78317.946241.885632.4032145.868867.5386Input-Attn-RNN (128)68.908935.345912.00347.989741.462829.7608152.328764.7685Temp-Attn-RNN (16)54.343532.870311.26277.211040.868329.0871140.683856.0774Temp-Attn-RNN (128)57.806531.991111.49807.115345.870530.0085128.064459.3527TCN (16)83.235049.579718.592011.0097675.9030131.4202258.170793.9882TCN (128)85.447967.368914.614110.7326995.0083133.4580265.3023100.9782LSTNet (16)50.595629.618613.09758.652446.920834.3753135.839668.8810LSTNet (128)83.299946.306013.31929.369850.057341.5482140.202172.9974DARNN (16)43.127528.955811.95688.068636.465826.6514123.055659.8798DARNN (128)45.211033.161211.89517.417733.855027.1255139.068664.3326DSTP (16)40.694624.526111.73597.134334.506322.7594138.895959.8884DSTP (128)36.260024.804811.79287.340635.117924.0093142.874456.9903DWNet31.576423.088810.38337.048331.328720.670682.111952.5880The window size of baseline methods is set to 16 and 128, and the short window size and long window size of DWNet are set to 16 and 128, respectively.Table1 shows that DWNet achieves the best RMSE and MAE across four datasets. Table 2 shows that DWNet also achieves the best MAPE and SMAPE in four datasets. This is because DWNet obtains not only the short-term dependency in the short sequence but also the long-term dependency in the long sequence. ARIMA performs worse than other models for ARIMA cannot capture linear relationships and does not consider the spatial correlation between exogenous series [7]. Encoder-Decoder network performs better than normal LSTM in four datasets, which means Encoder-Decoder is easier to obtain dependency from raw data [16]. Attention-based Encoder-Decoder networks, that is, Input-Attn-RNN and Temp-Attn-RNN, are better than normal Encoder-Decoder networks in four datasets because the attention mechanism pays more attention to more important features in raw data. DARNN and DSTP combine spatial attention and temporal attention mechanism and have good performance in four datasets. The performance of TCN is very unstable, and its performance in Human Sports is better than DSTP, but it is far worse than DARNN and DSTP in other datasets, especially EEG. LSTNet’s performance is also unstable. And it performs very well in Human Sports, but it performs poorly in the other three datasets. Meanwhile, we can also find that LSTM-based networks perform better than long sequences in short sequences.


### 5.2. Time Step Study

In this section, we study the impact of long window sizeTl and short window size Ts on prediction. When we vary Tl and Ts, we keep other parameters fixed. We plot the RMSE versus different long window size (Tl∈64,128,256,512) and short window size (Ts∈4,8,16,32) in Figure 2.Figure 2
Performance of DWNet in Human Sports based on different short window sizeTs and long window size Tl. We use different colors to indicate the prediction effect. The better the prediction, the darker the color.It is easily observed that the performance of DWNet is simultaneously affected by two parametersTl and Ts. When Tl is fixed, the performance of DWNet will be worse when Ts is too large or too small and vice versa. And we notice that DWNet achieves the best performance when Tl=128 and Ts=16.


### 5.3. Ablation Experiment

To further investigate the effectiveness of each model component, we compare DWNet with Input-Attn-RNN, Temp-Attn-RNN, DARNN, and other variants in Human Sports and EEG datasets. In this experiment, we set window sizeT of Input-Attn-RNN, Temp-Attn-RNN, and DARNN to 16 and set Tl=128 and Ts=16. The variants of DWNet are as follows:(i)
DWNet-ni: there is no spatial attention module in the Encoder part.(ii)
DWNet-nt: there is no temporal attention module in the Decoder part.The experiment results are shown in Figure3. Input-Attn-RNN performs better than Temp-Attn-RNN in the EEG dataset but performs worse than Temp-Attn-RNN in the Human Sports dataset. However, DARNN achieves better RMSE and MAE than Input-Attn-RNN and Temp-Attn-RNN in both two datasets. Apparently, the model based on a two-stage attention mechanism is better than the single attention model. And that is why DWNet is superior to DWNet-ni and DWNet-nt. It is easily observed that DWNet achieves the best RMSE in Human Sports and EEG, which shows that the information in the long sequence is valuable for the time prediction task. Without the long sequence processing module, it is impossible to outperform the state-of-the-art methods in time series prediction.Figure 3
Performance of different methods in Human Sports and EEG. (a) RMSE and MAE versus different methods over Human Sports. (b) RMSE and MAE versus different methods over EEG.
(a)(b)


### 5.4. Time Complexity

The time efficiency of deep neural networks is also an evaluation metric that needs to be considered. In this section, we compare the time efficiency of DWNet and baseline methods. In this experiment, we setT to 16, Tl to 128, Ts to 16, and fixed other parameters. We experimented on Human Sports and EEG datasets and recorded the time (in seconds) spent in 10 epochs. The results are shown in Figure 4. We can observe that, with more attention modules, the time spent by the model gradually increases. Input-Attn-RNN and Temp-Attn-RNN have only one attention module: one is spatial attention and the other is temporal attention, but the amount of computation is essentially the same. Temp-Attn-RNN’s training time is slightly longer than Input-Attn-RNN, but it is far less than the DARNN that both attention modules have. DSTP has two attention modules in the Encoder part and one attention module in the Decoder part, so the training time spent is longer than DARNN. TCN is superior to fewer parameters and the characteristics of parallel processing and has a very large advantage in time spent. It takes the least time in both two datasets. In DWNet, there are two attention modules and a long sequence processing module (implemented by TCN). Therefore, DWNet is inferior to DARNN in terms of time efficiency and even worse than TCN. However, DWNet has stronger time series forecasting capabilities than DARNN and TCN and is more suitable for situations that require high accuracy rather than low time consumption.Figure 4
Time spent per 10 epoch in different models and datasets.


## 5.1. Model Comparison

To show the effectiveness of DWNet, we compare DWNet with 9 different methods, including the state-of-the-art methods and emerging methods. For the sake of fairness, we use two different window sizes for baseline methods so that we can compare the baselines’ results of long window size and short window size with DWNet. The prediction results of DWNet and baseline methods are shown in Tables1 and 2 .Table 1
RMSE and MAE performance comparison among different methods and datasets (best result is displayed inboldface).
ModelsSML 2010Human SportsEEGEnergyRMSEMAERMSEMAERMSEMAERMSEMAEARIMA (16)0.27860.22190.13710.06170.56940.47240.86400.5740LSTM (16)0.19050.14890.08310.03250.22440.17240.69070.3663LSTM (128)0.20990.16710.09830.04370.30330.22830.80170.4376Encoder-Decoder (16)0.14380.09070.07740.02960.24990.14010.59830.2839Encoder-Decoder (128)0.16480.10120.08310.03030.46500.30360.65240.3117Input-Attn-RNN (16)0.12960.07620.06800.02820.20550.14470.54520.2564Input-Attn-RNN (128)0.10080.08970.07660.03620.42170.28810.57820.2502Temp-Attn-RNN (16)0.10970.06920.06460.03110.22200.15000.54140.2507Temp-Attn-RNN (128)0.11050.07700.07400.03340.39430.29980.54880.2563TCN (16)0.11560.08170.06280.02701.18450.95450.82790.5186TCN (128)0.14730.11360.07270.03291.10500.86960.81260.4567LSTNet (16)0.12770.09570.05820.02690.23220.18070.57330.2762LSTNet (128)0.13520.10200.06420.03120.23840.18680.60780.3296DARNN (16)0.09770.06440.06430.02320.18040.14420.52700.2439DARNN (128)0.10930.07780.07330.04350.34830.32500.55560.2525DSTP (16)0.09320.06140.06410.02270.18050.14140.53200.2459DSTP (128)0.09540.06700.06410.02350.17540.13840.54560.2525DWNet0.08910.05650.05750.02170.17020.13710.50150.2362The window size of baseline methods is set to 16 and 128, and the short window size and long window size of DWNet are set to 16 and 128, respectively.Table 2
MAPE and SMAPE performance comparison among different methods and datasets (best result is displayed inboldface).
ModelsSML 2010Human SportsEEGEnergyMAPE (%)SMAPE (%)MAPE (%)SMAPE (%)MAPE (%)SMAPE (%)MAPE (%)SMAPE (%)ARIMA (16)123.099362.009822.350718.4392159.634883.7905178.436577.4287LSTM (16)78.909545.008217.443913.980380.342756.9819163.984965.8066LSTM (128)83.102149.543917.903512.003387.560963.5271176.341569.5442Encoder-Decoder (16)70.714243.076013.33269.561066.463538.5606170.086369.3110Encoder-Decoder (128)78.998150.502215.798710.092379.344540.2327181.758376.1764Input-Attn-RNN (16)61.112130.099711.78317.946241.885632.4032145.868867.5386Input-Attn-RNN (128)68.908935.345912.00347.989741.462829.7608152.328764.7685Temp-Attn-RNN (16)54.343532.870311.26277.211040.868329.0871140.683856.0774Temp-Attn-RNN (128)57.806531.991111.49807.115345.870530.0085128.064459.3527TCN (16)83.235049.579718.592011.0097675.9030131.4202258.170793.9882TCN (128)85.447967.368914.614110.7326995.0083133.4580265.3023100.9782LSTNet (16)50.595629.618613.09758.652446.920834.3753135.839668.8810LSTNet (128)83.299946.306013.31929.369850.057341.5482140.202172.9974DARNN (16)43.127528.955811.95688.068636.465826.6514123.055659.8798DARNN (128)45.211033.161211.89517.417733.855027.1255139.068664.3326DSTP (16)40.694624.526111.73597.134334.506322.7594138.895959.8884DSTP (128)36.260024.804811.79287.340635.117924.0093142.874456.9903DWNet31.576423.088810.38337.048331.328720.670682.111952.5880The window size of baseline methods is set to 16 and 128, and the short window size and long window size of DWNet are set to 16 and 128, respectively.Table1 shows that DWNet achieves the best RMSE and MAE across four datasets. Table 2 shows that DWNet also achieves the best MAPE and SMAPE in four datasets. This is because DWNet obtains not only the short-term dependency in the short sequence but also the long-term dependency in the long sequence. ARIMA performs worse than other models for ARIMA cannot capture linear relationships and does not consider the spatial correlation between exogenous series [7]. Encoder-Decoder network performs better than normal LSTM in four datasets, which means Encoder-Decoder is easier to obtain dependency from raw data [16]. Attention-based Encoder-Decoder networks, that is, Input-Attn-RNN and Temp-Attn-RNN, are better than normal Encoder-Decoder networks in four datasets because the attention mechanism pays more attention to more important features in raw data. DARNN and DSTP combine spatial attention and temporal attention mechanism and have good performance in four datasets. The performance of TCN is very unstable, and its performance in Human Sports is better than DSTP, but it is far worse than DARNN and DSTP in other datasets, especially EEG. LSTNet’s performance is also unstable. And it performs very well in Human Sports, but it performs poorly in the other three datasets. Meanwhile, we can also find that LSTM-based networks perform better than long sequences in short sequences.


## 5.2. Time Step Study

In this section, we study the impact of long window sizeTl and short window size Ts on prediction. When we vary Tl and Ts, we keep other parameters fixed. We plot the RMSE versus different long window size (Tl∈64,128,256,512) and short window size (Ts∈4,8,16,32) in Figure 2.Figure 2
Performance of DWNet in Human Sports based on different short window sizeTs and long window size Tl. We use different colors to indicate the prediction effect. The better the prediction, the darker the color.It is easily observed that the performance of DWNet is simultaneously affected by two parametersTl and Ts. When Tl is fixed, the performance of DWNet will be worse when Ts is too large or too small and vice versa. And we notice that DWNet achieves the best performance when Tl=128 and Ts=16.


## 5.3. Ablation Experiment

To further investigate the effectiveness of each model component, we compare DWNet with Input-Attn-RNN, Temp-Attn-RNN, DARNN, and other variants in Human Sports and EEG datasets. In this experiment, we set window sizeT of Input-Attn-RNN, Temp-Attn-RNN, and DARNN to 16 and set Tl=128 and Ts=16. The variants of DWNet are as follows:(i)
DWNet-ni: there is no spatial attention module in the Encoder part.(ii)
DWNet-nt: there is no temporal attention module in the Decoder part.The experiment results are shown in Figure3. Input-Attn-RNN performs better than Temp-Attn-RNN in the EEG dataset but performs worse than Temp-Attn-RNN in the Human Sports dataset. However, DARNN achieves better RMSE and MAE than Input-Attn-RNN and Temp-Attn-RNN in both two datasets. Apparently, the model based on a two-stage attention mechanism is better than the single attention model. And that is why DWNet is superior to DWNet-ni and DWNet-nt. It is easily observed that DWNet achieves the best RMSE in Human Sports and EEG, which shows that the information in the long sequence is valuable for the time prediction task. Without the long sequence processing module, it is impossible to outperform the state-of-the-art methods in time series prediction.Figure 3
Performance of different methods in Human Sports and EEG. (a) RMSE and MAE versus different methods over Human Sports. (b) RMSE and MAE versus different methods over EEG.
(a)(b)


## 5.4. Time Complexity

The time efficiency of deep neural networks is also an evaluation metric that needs to be considered. In this section, we compare the time efficiency of DWNet and baseline methods. In this experiment, we setT to 16, Tl to 128, Ts to 16, and fixed other parameters. We experimented on Human Sports and EEG datasets and recorded the time (in seconds) spent in 10 epochs. The results are shown in Figure 4. We can observe that, with more attention modules, the time spent by the model gradually increases. Input-Attn-RNN and Temp-Attn-RNN have only one attention module: one is spatial attention and the other is temporal attention, but the amount of computation is essentially the same. Temp-Attn-RNN’s training time is slightly longer than Input-Attn-RNN, but it is far less than the DARNN that both attention modules have. DSTP has two attention modules in the Encoder part and one attention module in the Decoder part, so the training time spent is longer than DARNN. TCN is superior to fewer parameters and the characteristics of parallel processing and has a very large advantage in time spent. It takes the least time in both two datasets. In DWNet, there are two attention modules and a long sequence processing module (implemented by TCN). Therefore, DWNet is inferior to DARNN in terms of time efficiency and even worse than TCN. However, DWNet has stronger time series forecasting capabilities than DARNN and TCN and is more suitable for situations that require high accuracy rather than low time consumption.Figure 4
Time spent per 10 epoch in different models and datasets.


## 6. Conclusion

In this paper, we propose a dual-window deep neural network (DWNet) to make good use of the long sequence for time series prediction. The dual-window mechanism splits the end of a sequence as a short sequence and treats this sequence as a long sequence. The long sequence processing module in DWNet can extract historical information from long time series, and the short sequence processing module obtains recent information from short time series. These allow the model to learn both long-term dependence and short-term of the sequence. Our model outperforms the state-of-the-art methods in four datasets. In the future, we are going to perform model compression and reduce the model running time. Moreover, we will improve the long sequence processing module and enhance its stability, thereby enhancing the performance of DWNet.



---

*Source: 1125630-2021-10-13.xml*