Forecasting stock prices with long-short term memory neural network based on attention mechanism

Autoři: Jiayu Qiu aff001;  Bin Wang aff001;  Changjun Zhou aff002
Působiště autorů: Key Laboratory of Advanced Design and Intelligent Computing (Dalian University), Ministry of Education, Dalian, China aff001;  College of Computer Science and Engineering, Dalian Minzu University, Dalian, China aff002
Vyšlo v časopise: PLoS ONE 15(1)
Kategorie: Research Article


The stock market is known for its extreme complexity and volatility, and people are always looking for an accurate and effective way to guide stock trading. Long short-term memory (LSTM) neural networks are developed by recurrent neural networks (RNN) and have significant application value in many fields. In addition, LSTM avoids long-term dependence issues due to its unique storage unit structure, and it helps predict financial time series. Based on LSTM and an attention mechanism, a wavelet transform is used to denoise historical stock data, extract and train its features, and establish the prediction model of a stock price. We compared the results with the other three models, including the LSTM model, the LSTM model with wavelet denoising and the gated recurrent unit(GRU) neural network model on S&P 500, DJIA, HSI datasets. Results from experiments on the S&P 500 and DJIA datasets show that the coefficient of determination of the attention-based LSTM model is both higher than 0.94, and the mean square error of our model is both lower than 0.05.

Klíčová slova:

Artificial neural networks – Finance – Mathematical functions – Memory – Recurrent neural networks – Stock markets – Wavelet transforms – Forecasting


1. Zhi S U, Man L U, Dexuan L I. Deep Learning in Financial Empirical Applications:Dynamics,Contributions and Prospects[J]. Journal of Financial Research, 2017.

2. Bin Weng, Ahmed M A, Megahed F M. Stock Market One-day ahead Movement Prediction Using Disparate Data Sources [J]. Expert Systems with Applications, 2017, 79(2): 153–163.

3. Xu T, Zhang J, Ma Z, et al. Deep LSTM for Large Vocabulary Continuous Speech Recognition[J]. 2017.

4. Kim J, El-Khamy M, Lee J. Residual LSTM: Design of a Deep Recurrent Architecture for Distant Speech Recognition[J]. 2017.

5. Shih C H, Yan B C, Liu S H, et al. Investigating Siamese LSTM networks for text categorization[C]// Asia-pacific Signal & Information Processing Association Summit & Conference. 2017.

6. Simistira F, Ul-Hasan A, Papavassiliou V, et al. Recognition of Historical Greek Polytonic Scripts Using LSTM Networks[C]// 13th International Conference on Document Analysis and Recognition. 2015.

7. Bontempi G, Taieb S B, Yann-Aël Le Borgne. Machine learning strategies for time series forecasting[C]// European Business Intelligence Summer School. ULB—Universite Libre de Bruxelles, 2013.8.

8. Tay F E H, Cao L. Application of support vector machines in financial time series forecasting[J]. Journal of University of Electronic Science & Technology of China, 2007, 29(4):309–317.

9. Lin Y, Guo H, Hu J. An SVM-based approach for stock market trend prediction[C]// The 2013 International Joint Conference on Neural Networks (IJCNN). IEEE, 2013.

10. Wanjawa B W, Muchemi L. ANN Model to Predict Stock Prices at Stock Exchange Markets[J]. Papers, 2014.

11. Zhang R, Yuan Z, Shao X. A New Combined CNN-RNN Model for Sector Stock Price Analysis[C]// 2018 IEEE 42nd Annual Computer Software and Applications Conference (COMPSAC). IEEE Computer Society, 2018.

12. Ha Young Kim, Chang Hyun Won. Forecasting the volatility of stock price index: A hybrid model integrating LSTM with multiple GARCH-type models[J]. Expert Systems With Applications,2018,103.

13. Liu S, Zhang C, Ma J. CNN-LSTM Neural Network Model for Quantitative Strategy Analysis in Stock Markets[C]// International Conference on Neural Information Processing. Springer, Cham, 2017.

14. Zhao Z, Rao R, Tu S, et al. Time-Weighted LSTM Model with Redefined Labeling for Stock Trend Prediction[C]// 2017 IEEE 29th International Conference on Tools with Artificial Intelligence (ICTAI). IEEE, 2017.

15. Jiang Q, Tang C, Chen C, et al. Stock Price Forecast Based on LSTM Neural Network[J]. 2018.

16. Jin Z, Yang Y, Liu Y. Stock Closing Price Prediction Based on Sentiment Analysis and LSTM[J]. Neural Computing and Applications, 2019(3).

17. Lecun Y, Bengio Y, Hinton G. Deep learning.[J]. Nature, 2015, 521(7553):436. doi: 10.1038/nature14539 26017442

18. Abedinia O, Amjady N, Zareipour H.A new feature selection technique for load and price forecast of electrical power systems[J].IEEE Transactions on Power Systems, 2017,32 (1):62–74.

19. Song T, Pan L. Spiking neural P systems with request rules[J]. Neurocomputing, 2016:S0925231216002034, Pages 193–200

20. Song T, Gong F, Liu X, et al. Spiking Neural P Systems with White Hole Neurons[J]. IEEE Transactions on NanoBioscience, 2016, 15(7):1–1.

21. Song T, Zheng P, Wong M L D, et al. Design of Logic Gates Using Spiking Neural P Systems with Homogeneous Neurons and Astrocytes-like Control[J]. Information Sciences, 2016, 372:380–391.

22. Mnih V, Heess N, Graves A, et al. Recurrent Models of Visual Attention[J]. Advances in neural information processing systems, 2014.

23. Bahdanau D, Cho K, Bengio Y. Neural Machine Translation by Jointly Learning to Align and Translate[J]. Computer Science, 2014.

24. Liu Huicheng. Leveraging Financial News for Stock Trend Prediction with Attention-Based Recurrent Neural Network[J]. 2018.

25. Wang Q, Li Y, Liu X. Analysis of Feature Fatigue EEG Signals Based on Wavelet Entropy[J]. International Journal of Pattern Recognition & Artificial Intelligence, 2018, 32(8):1854023.

26. Sun Y, Shen X, Lv Y, et al. Recaptured Image Forensics Algorithm Based on Multi-Resolution Wavelet Transformation and Noise Analysis[J]. International Journal of Pattern Recognition & Artificial Intelligence, 2017, 32(02):1790–1793.

27. Ramsey JB. The contribution of wavelets to the analysis of economic and financial data. Philosophical Transactions of the Royal Society B Biological Sciences. 1999; 357(357):2593–606.

28. Dessaint O, Foucault T, Frésard Laurent, et al. Noisy Stock Prices and Corporate Investment[J]. Social Science Electronic Publishing;2018.

29. Chang S, Gupta R, Miller S M, et al. Growth Volatility and Inequality in the U.S.: A Wavelet Analysis[J]. Working Papers, 2018.

30. Ardila D, Sornette D. Dating the financial cycle with uncertainty estimates: a wavelet proposition[J]. Finance Research Letters, 2016:S1544612316301593.

Článek vyšel v časopise


2020 Číslo 1
Nejčtenější tento týden