Computer Engineering and Applications ›› 2023, Vol. 59 ›› Issue (15): 300-309.DOI: 10.3778/j.issn.1002-8331.2205-0025

• Engineering and Applications • Previous Articles     Next Articles

Stock Price Prediction Research Based on RF-SA-GRU Model

ZOU Jie, LI Lu   

  1. School of Mathematics, Physics and Statistics, Shanghai University of Engineering Science, Shanghai 201600, China
  • Online:2023-08-01 Published:2023-08-01

RF-SA-GRU模型的股价预测研究

邹婕,李路   

  1. 上海工程技术大学 数理与统计学院,上海 201600

Abstract: Aiming at the complex characteristics of stocks such as multi-factor, high randomness and non-stationaryness, the use of gated recurrent unit(GRU) network to directly predict the stock price is less effective. Based on fusing the self-attention mechanism(SA) and GRU to construct the SA-GRU model, the dimensionality reduction processing technique random forest(RF) algorithm is introduced to filter other factors for stock closing prices, and the reduced-dimensional stock factor data is used as the input to the SA-GRU model. Based on the two-layer GRU network, the dependencies between the stock factors are extracted, and then the SA is used to strengthen the attention to the important factors and the internal connections of the factors, and the stock factor data after the attention weight is added, and the stock price prediction values are output through the fully connected layer, so as to construct the RF-SA-GRU hybrid model. Eighteen stocks involving 18 basic industries are selected for stock price prediction, and the experiments show that the RF-SA-GRU model achieves the best prediction results on all 18 stocks, and the prediction accuracy and stability are better than other models. In addition, three indexes are selected for closing point prediction, and the experiment shows that the RF-SA-GRU model still has better prediction performance in terms of stock index forecasting.

Key words: stock price prediction, random forest(RF), self-attention mechanism(SA), gated recurrent unit(GRU)

摘要: 针对股票具有多因子、高随机性和非平稳性等复杂特征,利用门控循环单元(GRU)网络直接进行股价预测效果较差的问题。在融合自注意力机制(SA)和GRU,构建SA-GRU模型的基础上,引入降维处理技术随机森林(RF)算法,针对股票收盘价筛选其他因子,将经过降维的股票因子数据作为SA-GRU模型的输入。基于双层GRU网络提取股票因子间的依赖关系,再利用SA加强对重要因子的关注和因子内部的联系,得到加入注意力权重后的股票因子数据,通过全连接层输出股价预测值,从而构建RF-SA-GRU混合模型。选取涉及18个基础行业的18只股票进行股价预测,实验显示RF-SA-GRU模型在18只股票上均取得好的预测效果,且预测精度和稳定性均优于其他模型。此外,选取3个指数进行收盘点位预测,实验显示RF-SA-GRU模型在股指预测方面依旧具有更好的预测性能。

关键词: 股票价格预测, 随机森林(RF), 自注意力机制(SA), 门控循环单元(GRU)