Skip to main content

A Self-Attention-Based Stock Prediction Method Using Long Short-Term Memory Network Architecture

  • Conference paper
  • First Online:
Data Science (ICPCSEE 2023)

Part of the book series: Communications in Computer and Information Science ((CCIS,volume 1879))

  • 345 Accesses

Abstract

The ability to analyze the trend of the stock market has always been paid high attention to. A large number of machine learning technologies have been used for stock analysis and prediction. The traditional time series prediction models, including RNN, LSTM and their deformed bodies, show the problems of gradient disappearance and low efficiency in long-span prediction. This paper proposes a long-term and short-term memory network architecture, which based on Encoder and Decoder Stacks and self-attention mechanism, replacing the feature extraction part of traditional LSTM through self-attention mechanism and provides interpretable insights into the dynamics of time. Through the results of simulation experiments, this paper shows the comparison of stock prediction effects through using RNN, Bi-LSTM and Encoder and Decoder-Attention-LSTM models. The experimental task shows that the prediction accuracy of this model is improved by an order of magnitude compared with the traditional LSTM-like model, and can achieve high accuracy when the epoch is small.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 79.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 99.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Liu, J., Lin, C.M.M., Chao, F.: Gradient boost with convolution neural network for stock forecast. In: Ju, Z., Yang, L., Yang, C., Gegov, A., Zhou, D. (eds.) UKCI 2019. AISC, vol. 1043, pp. 155–165. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-29933-0_13

  2. Gong, Y., Ming-Tai Wu, J., Li, Z., Liu, S., Sun, L., Chen, C.M.: A CNN-based method for AAPL stock price trend prediction using historical data and technical indicators. In: Zhang, J.F., Chen, C.M., Chu, S.C., Kountchev, R. (eds.) Advances in Intelligent Systems and Computing. SIST, vol. 268, pp. 25–33. Springer, Singapore (2022). https://doi.org/10.1007/978-981-16-8048-9_3

  3. Zheng, Y., Si, Y.W., Wong, R.: Feature extraction for chart pattern classification in financial time series. Knowl. Inf. Syst. 63, 1807–1848 (2021). https://doi.org/10.1007/s10115-021-01569-1

  4. Sakhare, N.N., Shaik, I.S., Saha, S.: Prediction of stock market movement via technical analysis of stock data stored on blockchain using novel history bits based machine learning algorithm. IET Soft., 1– 12 (2023). https://doi.org/10.1049/sfw2.12092

  5. Jin, Z., Jin, Y., Chen, Z.: Empirical mode decomposition using deep learning model for financial market forecasting. PeerJ Comput. Sci. 8, e1076 (2022). https://doi.org/10.7717/peerj-cs.1076

    Article  Google Scholar 

  6. Hao, H., Wang, Y., Xia, Y., et al.: Temporal convolutional attention-based network for sequence modeling. arXiv preprint arXiv:2002.12530 (2020)

  7. Wu, N., Green, B., Ben, X., et al.: Deep transformer models for time series forecasting: the influenza prevalence case. arXiv preprint arXiv:2001.08317 (2020)

  8. Vaswani, A., et al.: Attention is all you need. In: Proceedings of the 31st International Conference on Neural Information Processing Systems (NIPS 2017), pp. 6000–6010. Curran Associates Inc., Red Hook (2017)

    Google Scholar 

  9. Lim, B., Arık, S.Ö., Loeff, N., et al.: Temporal fusion transformers for interpretable multi-horizon time series forecasting. Int. J. Forecast. 37(4), 1748–1764 (2021)

    Article  Google Scholar 

  10. Shah, D., Campbell, W., Zulkernine, F.H.: A comparative study of LSTM and DNN for stock market forecasting. In: 2018 IEEE International Conference on Big Data (Big Data), pp. 4148–4155. IEEE (2018)

    Google Scholar 

  11. Vanguri, N.Y., Pazhanirajan, S., Kumar, T.A.: Tversky-RideNN based feature fusion and optimized deep RNN for stock market prediction. In: 2022 4th International Conference on Inventive Research in Computing Applications (ICIRCA), Coimbatore, India, pp. 1056–1063 (2022). https://doi.org/10.1109/ICIRCA54612.2022.9985572

  12. Chen, W., Yeo, C.K., Lau, C.T., Lee, B.S.: Leveraging social media news to predict stock index movement using RNN-boost. Data Knowl. Eng. 118, 14–24 (2018)

    Article  Google Scholar 

  13. Zhang, R., Yuan, Z., Shao, X.: A new combined CNN-RNN model for sector stock price analysis. In: 2018 IEEE 42nd Annual Computer Software and Applications Conference (COMPSAC), Tokyo, Japan, pp. 546–551 (2018). https://doi.org/10.1109/COMPSAC.2018.10292

  14. Chung, J., Jang, B.: Hybrid CNN-LSTM model with multivariate data to increase the forecast accuracy of electricity consumption. SSRN. https://ssrn.com/abstract=4097479 or https://doi.org/10.2139/ssrn.4097479

  15. Liu, S., Chen, Y.: Comparison of variant principal component analysis using new RNN-based framework for stock prediction. In: 2021 International Conference on Data Mining Workshops (ICDMW), Auckland, New Zealand, pp. 1047–1056 (2021). https://doi.org/10.1109/ICDMW53433.2021.00136

  16. Zhang, X., Gu, N., Chang, J., Ye, H.: Predicting stock price movement using a DBN-RNN. Appl. Artif. Intell. 35(12), 876–892 (2021). https://doi.org/10.1080/08839514.2021.1942520

  17. Singh, N., Mohan, B.R., Naik, N.: Hybrid model of multifactor analysis with RNN-LSTM to predict stock price. In: Gupta, D., Sambyo, K., Prasad, M., Agarwal, S. (eds.) Advanced Machine Intelligence and Signal Processing. LNEE, vol. 858, pp. 107–122. Springer, Singapore (2022). https://doi.org/10.1007/978-981-19-0840-8_8

  18. Weng, X., Lin, X., Zhao, S.: Stock price prediction based on LSTM and bert. In: 2022 International Conference on Machine Learning and Cybernetics (ICMLC), Japan, pp. 12–17 (2022). https://doi.org/10.1109/ICMLC56445.2022.9941293

  19. Wang, C., Chen, Y., Zhang, S., et al.: Stock market index prediction using deep transformer model. Expert Syst. Appl. 208, 118128 (2022)

    Article  Google Scholar 

  20. Wen, Q., Zhou, T., Zhang, C., et al.: Transformers in time series: a survey. arXiv preprint arXiv:2202.07125 (2022)

  21. Salinas, D., Flunkert, V., Gasthaus, J., et al.: DeepAR: probabilistic forecasting with autoregressive recurrent networks. Int. J. Forecast. 36(3), 1181–1191 (2020)

    Article  Google Scholar 

  22. Cho, K., Merrienboer, B.V., Gulcehre, C., et al.: Learning phrase representations using RNN encoder-decoder for statistical machine translation. Comput. Sci. (2014)

    Google Scholar 

  23. Shah, J., Jain, R., Jolly, V., Godbole, A.: Stock market prediction using bi-directional LSTM. In: 2021 International Conference on Communication information and Computing Technology (ICCICT), Mumbai, India, pp. 1–5 (2021). https://doi.org/10.1109/ICCICT50803.2021.9510147

  24. Dey, P., et al.: Comparative analysis of recurrent neural networks in stock price prediction for different frequency domains. Algorithms 14, 251 (2021). https://doi.org/10.3390/a14080251

    Article  Google Scholar 

Download references

Acknowledgment

This work is supported by the National Nature Science Foundation of China through project 51979048.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Pengyuan Bian .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Ye, X., Ning, B., Bian, P., Feng, X. (2023). A Self-Attention-Based Stock Prediction Method Using Long Short-Term Memory Network Architecture. In: Yu, Z., et al. Data Science. ICPCSEE 2023. Communications in Computer and Information Science, vol 1879. Springer, Singapore. https://doi.org/10.1007/978-981-99-5968-6_2

Download citation

  • DOI: https://doi.org/10.1007/978-981-99-5968-6_2

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-99-5967-9

  • Online ISBN: 978-981-99-5968-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics