## 4 Results and Discussion
### Ablation Test on Memory Attention Module  
The primary objective of this ablation study is to assess the impact of various attention mechanisms on the model's performance in stock price prediction tasks. Specifically, it is aimed to verify whether the Memory Attention module can bring significant performance improvements to the model and to compare it with other prevalent attention mechanisms. Through this design, a deeper understanding of how the Memory Attention Module enhances the model's predictive capabilities can be obtained, revealing its underlying mathematical principles.  
By examining the data in Table 2, it can be observed that various attention mechanisms have commendable performance in stock price prediction tasks, but there is a disparity in their performances. SENet [20], a channel attention mechanism, emphasizes the channel relationship of features. Its performance in this experiment is relatively commendable, indicating that channel relationships are beneficial for time series prediction. However, since it primarily focuses on channel relationships rather than long-term time series dependencies, its performance is slightly inferior to other mechanisms. CBAM [21] combines spatial attention with channel attention. Although its performance is slightly less stellar than SENet, it suggests that relying solely on spatial and channel relationships might not capture all the information in complex time series tasks. Multi-head attention [13], a core component of the Transformer structure, allows the model to capture information across different subspaces. Its performance surpasses both SENet and CBAM, illustrating the advantage of multi-head attention in capturing long-term dependencies in time series data. The Memory Attention, which is central to this research, considers not only the current input features but also past essential information. It exhibits the best performance across all evaluation metrics, validating the efficacy of the Memory module in enhancing the model's capability to capture long-term dependencies.  
Different attention mechanisms possess distinct mathematical characteristics. SENet and CBAM primarily focus on local or inter-channel relationships in feature maps rather than the long-term dependencies in time series data. Hence, when faced with intricate time series prediction tasks, they might not fully capture all patterns in the data. Multi-head attention, by parallel processing across various subspaces, can more effectively capture long-term dependencies. Nevertheless, it might still fail to store and utilize key information over extended periods. From a mathematical perspective, the Memory Attention module provides the model with a mechanism to \"recall\" and harness past critical information. This memory capability, especially in tasks such as stock price prediction, can assist the model in better understanding and predicting future trends. In summary, this ablation study underscores the significance of attention mechanisms in intricate time series prediction tasks. Particularly, the introduced Memory Attention module, by integrating current input features with past essential information, significantly boosts the model's predictive performance. This affirms the pivotal role of deeply considering long-term dependencies in time series data when crafting effective predictive models.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Attention Mechanism** & **Precision** & **Recall** & **Accuracy** & \(\mathbf{R^{2}}\) & **Adjusted \(\mathbf{R^{2}}\)** \\ \hline SENet [20] & 0.90 & 0.89 & 0.90 & 0.92 & 0.92 \\ CBAM [21] & 0.86 & 0.88 & 0.88 & 0.87 & 0.87 \\ Multi-head Attention [13] & 0.91 & 0.88 & 0.89 & 0.88 & 0.88 \\ Memory Attention & 0.95 & 0.91 & 0.94 & 0.97 & 0.97 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Performance comparison of different attention mechanisms on the evaluation metrics.