# Effective Bus Travel Time Prediction System of Multiple Routes: Introducing PMLNet Based on MDARNN
## 3 Materials and Methods
### Method
#### 3.2.3 Travel Time Prediction Model  
On the basis of MDARNN, LSTM, and 4 traffic impact factors, in this paper, a parallel prediction and calibration model namely PMLNet, is proposed. Illustrated in Figure 6, PMLNet utilizes 4 basic prediction models to predict corresponding time parts. Subsequently, the 4 time parts are calibrated by real-time traffic flow factors, respectively, and the corrected time periods constitute the final predicted time. The proposed MDARNN is described in details as follows. The MDARNN model, presented in this work, is developed upon the foundation of the DA-RNN model [12], which incorporates the attention mechanism in both encoder stage and decoder stage. This characteristic renders the model well-suited for long time series prediction. However, the traditional DA-RNN relies heavily on historical data to predict bus travel time, resulting in both information loss and waste of computing resources. In order to address the aforementioned issues, we incorporate macro factors into the DA-RNN model, presenting an enhanced iteration named MDARNN. The architecture of the MDARNN is depicted in Figure 7.  
Figure 6: The architecture of PMLNet. Figure 7: The architecture of MDARNN. The MDARNN employs a sequence-to-sequence architecture that encompasses encoding and decoding phases. The core components of MDARNN are depicted in Figure 8, which are the encoder and decoder. The processing procedure of MDARNN is outlined as follows:  
1. Local impact factor is denoted as Equation (10), where k is the \(k\)th local impact factors, \(T\) is the time step, and \(n\) represents the number of local impact factors. \[IT_{local}^{k}=\Big{(}IF_{local_{1}}^{k},IF_{local_{2}}^{k},\cdots,IF_{local_{ T}}^{k}\Big{)},\quad k=1,2,\ldots,n\] (11)
2. The attention layer outputs as Equation (12), where \(V_{e}^{T}\), \(W_{e}\), \(U_{e}\) are the parameters to be learned. For n local impact factors, the attention of each factor is \((e_{t}^{1},e_{t}^{2},\cdots,e_{t}^{n})\) at time \(t\), which is then employed as the input for the softmax layer. \[e_{t}^{k}=V_{e}^{T}\tanh\Big{(}W_{e}[h_{t-1},s_{t-1}]+U_{e}IF_{local}^{k}\Big{)}\] (12)
3. The weighted output vector of softmax layer is Equation (13) \[\Big{(}\alpha_{t}^{1},\ \ \alpha_{t}^{2},\cdots,\alpha_{t}^{n}\Big{)},\ \ \sum_{k=1}^{n}\alpha_{t}^{k}=1\] (13) where \(\alpha_{t}^{k}=\frac{\exp(c_{t}^{k})}{\sum_{l=1}^{n}\exp(c_{t}^{l})}\), which can be used to estimate the importance of the \(k\)th local impact factor at time \(t\). The weighted local impact factors, which are set as the input of the encoder, should be denoted as \(a_{t}^{k}=\frac{\exp(c_{t}^{k})}{\sum_{l=1}^{n}\exp(c_{t}^{l})}\), which can be used to estimate the importance of the \(k\)th local impact factor at time \(t\). The weighted local impact factors are set as the input of the encoder, and should be denoted as \(x_{t}\). \[\overline{IF_{local_{t}}}=\Big{(}\alpha_{t}^{1}IF_{local_{t}}^{1},\ \alpha_{t}^{2}IF_{local_{t}}^{2},\cdots,\alpha_{t}^{n}IF_{local_{t}}^{n}\Big{)}\] (14)
4. By inputting \(\overline{IF_{local_{t}}}\), the hidden layer state at time \(t\) is set as Equation (15), where \(f_{LSTM}^{1}\) is the encoder. Simultaneously, the hidden layer state at time \(t\) is obtained by employing an attention mechanism. \[h_{t}=f_{LSTM}^{1}\big{(}h_{t-1},\overline{IF_{local_{t}}}\big{)}\] (15)
5. The hidden layer outputs the vector as \((l_{t}^{1},l_{t}^{2},\cdots,l_{t}^{T})\), where \(l_{t}^{i}\) represents the hidden state attention of \(i\)th unit in encoder, and is defined as \[l_{t}^{i}=V_{d}^{T}\tanh\big{(}W_{d}\big{[}d_{t-1},s_{t-1}^{i}\big{]}+U_{d}h_{ i}\big{)}\] (16) where \(V_{d}^{T}\), \(W_{d}\), and \(U_{d}\) are the learnable parameters, \(d_{t-1}\) and \(s_{t-1}^{i}\) denote the previous step's hidden state and cell state of the decoder, respectively. The attention weight of the hidden state from the \(i\)th unit in the encoder is then defined as \[\beta_{t}^{i}=\frac{\exp(l_{t}^{i})}{\sum_{l=1}^{T}\exp(l_{t}^{l})}\] (17)
6.