Research on Stock Price Prediction Method Based on the GAN-LSTM-Attention Model
Peng Li, Yanrui Wei, Lili Yin*
College of Computer Science and Technology, Harbin University of Science and Technology, Harbin, 150006, China
* Corresponding Author: Lili Yin. Email:
Computers, Materials & Continua https://doi.org/10.32604/cmc.2024.056651
Received 27 July 2024; Accepted 25 September 2024; Published online 07 November 2024
Abstract
Stock price prediction is a typical complex time series prediction problem characterized by dynamics, nonlinearity, and complexity. This paper introduces a generative adversarial network model that incorporates an attention mechanism (GAN-LSTM-Attention) to improve the accuracy of stock price prediction. Firstly, the generator of this model combines the Long and Short-Term Memory Network (LSTM), the Attention Mechanism and, the Fully-Connected Layer, focusing on generating the predicted stock price. The discriminator combines the Convolutional Neural Network (CNN) and the Fully-Connected Layer to discriminate between real stock prices and generated stock prices. Secondly, to evaluate the practical application ability and generalization ability of the GAN-LSTM-Attention model, four representative stocks in the United States of America (USA) stock market, namely, Standard & Poor’s 500 Index stock, Apple Incorporated stock, Advanced Micro Devices Incorporated stock, and Google Incorporated stock were selected for prediction experiments, and the prediction performance was comprehensively evaluated by using the three evaluation metrics, namely, mean absolute error (MAE), root mean square error (RMSE), and coefficient of determination (R
2). Finally, the specific effects of the attention mechanism, convolutional layer, and fully-connected layer on the prediction performance of the model are systematically analyzed through ablation study. The results of experiment show that the GAN-LSTM-Attention model exhibits excellent performance and robustness in stock price prediction.
Keywords
Stock price prediction; generative adversarial network; attention mechanism; time-series prediction