# A Stock Prediction Method Based on Heterogeneous Bidirectional LSTM
## 5 Conclusions  
BiLSTM is currently a more advanced model. To further improve the performance of BiLSTM and better cope with the aperiodicity and volatility of financial market prices, this paper starts with the internal units of BiLSTM to improve the overall performance of the model. The V-LSTM unit is seamlessly integrated into BiLSTM, reconstructing it into He-BiLSTM and providing the backpropagation algorithm. The V-LSTM unit adds a new forget gate to the long-term memory \(c_{t}\), and the information forgotten by \(c_{t}\) and the information coupled with the forget gate \(f_{t}\) are used together as the input for the next unit. This allows each unit to utilize \(c_{t}\) when transmitting information backward, while at the same time, it simplifies the number of parameters that each LSTM unit needs to learn, improving the efficiency of internal information processing. These advantages of the V-LSTM unit, when applied to BiLSTM, will further enhance the performance of He-BiLSTM.  
To validate the robustness, accuracy, generalization ability, and model running speed of He-BiLSTM as superior, this paper has designed three experiments.  
Firstly, He-BiLSTM and BiLSTM are applied to predict the stock price of S&P 500 for the next day. The experimental results show that compared to BiLSTM, He-BiLSTM has a smaller mean squared error, being reduced by 38.36% in comparison to BiLSTM's mean squared error of 0.000318619, and with the accuracy rate being increased by 3.87% from 90.36%. Moreover, the improvement in He-BiLSTM's predictive capability is not only reflected in parts where the price changes abruptly but also during periods of stable prices, where the predictive accuracy is further enhanced. This also proves the strong robustness of the model.  
Secondly, to verify the generalization capability of He-BiLSTM, it was used to predict prices for multiple days in the future and compared with BiLSTM. The experiments showed that even when predicting up to 3 days into the future, He-BiLSTM can still maintain an accuracy rate of over 90% on the test set. Furthermore, He-BiLSTM not only performs better in stock index data prediction but also yields good results in the futures field. This proves that He-BiLSTM has stronger generalization capabilities.  
Lastly, in terms of model running speed, He-BiLSTM operates faster. When iterating 10 times under the same conditions, He-BiLSTM can reduce the time by approximately 7.70%.  
The performance characteristics of He-BiLSTM, when applied to the field of financial investment, can provide investors with more accurate price forecasts, more strategic choices for the future, and faster trading operations, thereby helping to address some of the risks inherent in the financial markets.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Running Time** & **BiLSTM** & **He-BiLSTM** \\ \hline
1 & 16.1525 & 13.6154 \\
2 & 35.5378 & 30.074 \\
3 & 54.527 & 46.0516 \\
4 & 71.0515 & 62.8683 \\
5 & 88.2446 & 78.1939 \\
6 & 106.69 & 94.4182 \\
7 & 123.867 & 112.488 \\
8 & 138.934 & 128.593 \\
9 & 156.113 & 143.171 \\
10 & 172.683 & 159.378 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Time consumed per iteration for the first 10 rounds.