## 3 System Model
### Cost-Loss Balanced Model  
Based on the above discussion, the real-time traffic flow prediction issue can be extracted as follows:  
\[ARG=\arg\min_{epo,rat,ww}\bigl{[}Cost(Q^{\prime})+Loss(Q^{\prime})\bigr{]}, \tag{14}\]  
where  
\[Cost(Q^{\prime})=\sum_{i=1}^{s}\Bigl{[}e^{(\omega_{1}epo+\omega_{2}rat)Q^{ \prime}_{i}}\Bigr{]}+\omega_{3}\tanh[Q^{\prime}_{i},\dots,Q^{\prime}_{i+ww.} \Bigr{]}; \tag{15}\]  
\[Loss(Q^{\prime})=\sum_{epo,rat,ww}\bigl{[}\log[\sigma(Q^{\prime}_{i})]+\log[1 -\sigma(Q^{\prime}_{i})]\bigr{]}.\]  
The constrains of the cost-loss balanced model are presented as follows:  
1. \(\omega_{1}+\omega_{2}+\omega_{3}=1\);
2. \(epo\leq epo_{thr}\);
3. \(ww+i\leq s\).  
The objective of the model aims to determine the most suitable parameters for prediction depending on the equilibrium between cost and loss. Here, _epo_ denotes the selected number of training iterations. \(rat\) is represented as the learning rate of original LSTM. \(ww\) denotes the width of the window size, which decides the duration of prediction.  
Figure 2: The structure of the LSTM memory block.  
The three parameters impact the performance of the overall performance. Based on the drift-plus-penalty architecture [19], we balance the cost and loss during the prediction and find the equilibrium to determine the parameters above. The loss decreases as the parameters change to improve the prediction accuracy, while the negative consequence is the encasement of the computation cost. Therefore, the sum of cost and loss reaches the minimum value as the three parameters achieve equilibrium.  
As shown in Equation (15), we define two variables, i.e., \(Cost(Q^{\prime})\) and \(Loss(Q^{\prime})\) to perform the computing cost and accuracy, respectively. \(Cost(Q^{\prime})\) denotes the computing time when the traffic flow data \(Q^{\prime}\) are input for prediction. Larger \(Cost(Q^{\prime})\) means the system takes an amount of time to calculate the prediction results. Meanwhile, \(Loss(Q^{\prime})\) is used for evaluating the accuracy of prediction results, which pursue a relatively small value. The cost and loss performance is assumed as having a non-linear positive correlation with the parameter epoch \(epo\) and learning rate \(rat\)[28]. \(\omega_{1}\) and \(\omega_{2}\) are used to adjust the ratio of these two parameters' influence. \(Q_{i}\) denotes the \(i\)th training traffic flow data. The correlation between cost and the third parameter is positive; however, the increasing ratio is gentle relatively in the medium range. Therefore, we exploit a tanh function to express this correlation. Here, \(\text{tanh}(\cdot)=\frac{\ell+e^{\alpha}}{\ell-e^{\alpha}}\). \(\omega_{3}\) denotes the weight parameter to adjust the third correction window width \(ww\). The loss performance relates to binary cross-entropy during the entire training based on the three parameters above. The variable in the logic function \(\sigma(\cdot)\) is also represented as the sigmoid function.  
Furthermore, the extracted cost-loss balanced model should consider three constrains: (1) the linear sum of three weights for epoch, learning rate, and window width is denoted as 1. The first constrain guarantees the three parts of cost performance are maintained at the same order of the magnitude. (2) and (3) limit the upper bound of the selection results of the epoch and window width. In the next section, we will discuss the detailed MVHS-LSTM algorithm to achieve the comprehensive consideration between the computing time and prediction accuracy based on this cost-loss balanced model.