## 4 Algorithm Design
As the iteration count escalates, the LSTM model acquires additional opportunities to learn and refine its parameters from the training data. Typically, this implies that the model can adapt more precisely to the data and exhibit superior performance on the test set. Nevertheless, an excessive number of iterations can potentially induce overfitting in the model, manifesting as excellent performance on training data but a decline in performance on unseen data. The iteration count serves as a direct determinant of the model training duration. Initially, as the iteration count rises, the model's error often decreases swiftly, displaying a rapid convergence rate. However, as the model nears its optimal solution, further iterations may yield only minor performance improvements and, in some cases, may even result in performance fluctuations or degradation. Based on aforementioned discussion, the system determines the parameters in offline process to reduce the computing time in prediction. Based on the aforementioned discussion, the system determines the parameters in the offline process to reduce the computing time in prediction. The offline system contains three layers. The first layer is the LSTM layer and four parameters are considered: batch size, input dimensions, window length, and the number of hidden layer units. The LSTM layer, also known as the long short-term memory layer, is the core part of the LSTM model. Its main function is to process sequence data and capture long-term dependencies in the data. Through its internal memory unit and gating mechanism, the LSTM layer can effectively handle the long-term dependency and gradient vanishing problems in time series data, thereby improving the model's prediction and classification capabilities. The first parameter is the number of samples that are input into MVHS-LSTM at one time. The second parameter is the number of input dimensions in the same time series, which can be a multi-dimensional input. The third and fourth parameters have been described above. The second layer is the Flatten layer, the function of the Flatten layer is transform the multidimensional input into one-dimension, that is, to flatten the multidimensional feature maps into one-dimensional feature vectors. This usually occurs after the convolutional layer is used to convert the multi-dimensional feature map output by the convolutional layer into a format that can be processed by the fully connected layer. The Flatten layer flattens multidimensional data,making it easier for subsequent fully connected layers to process this data. The third layer is the Dense layer, also known as the fully connected layer, and is typically located after the LSTM or Flatten layer. Its main function is to weigh and transform the features output from the previous layer to generate the final output. The basic idea of building the model is shown in Figure 1. Firstly, the algorithm imports the data and processes the traffic flow data and then normalizes the data by compressing them between 0 and 1. The data are divided according to the holdout method, which separates them into a training set and a test set based on a specified proportion. Then, the model undergoes training, which consists of three layers: the LSTM layer, Flatten layer, and Dense layer. The LSTM layer is a type of recurrent neural network layer designed for handling sequential data. It captures and remembers long-term dependencies in the data using memory cells and gates. The Flatten layer transforms the multidimensional output from the LSTM layer into a one-dimensional vector. The Dense layer connects each neuron to every neuron in the previous and following layers. At the end of the training, the algorithm checks whether the specified number of iterations is completed. If the number of iterations has not been reached, the training continues. The model is documented so that the test set can be used in the online system when the specified number of iterations is reached. Finally, the test set data are fed into the model to obtain the prediction results.