Please wait a minute...
Advanced Search
数据分析与知识发现  2022, Vol. 6 Issue (12): 123-134     https://doi.org/10.11925/infotech.2096-3467.2022.0106
  研究论文 本期目录 | 过刊浏览 | 高级检索 |
融合情感特征的基于RoBERTa-TCN的股价预测研究
严冬梅(),何雯馨,陈智
天津财经大学理工学院 天津 300222
Predicting Stock Prices Based on RoBERTa-TCN and Sentimental Characteristics
Yan Dongmei(),He Wenxin,Chen Zhi
School of Science and Engineering, Tianjin University of Finance and Economics, Tianjin 300222, China
全文: PDF (957 KB)   HTML ( 31
输出: BibTeX | EndNote (RIS)      
摘要 

目的】 在股票预测模型中融入投资者情感特征以提升对股价走势的预测效果。【方法】 使用注意力机制将RoBERTa模型构建的投资者情感特征与时间卷积神经网络提取的股价特征进行融合,构造考虑投资者情感特征的RoBERTa-TCN股价预测模型。【结果】 与LSTM、GRU、TCN三个模型在6只股票数据集上的实验结果进行对比,RoBERTa-TCN模型在4个不同评价指标上有平均约0.490 6的提升。【局限】 未考虑股票交易日的时间特殊性对股价波动的影响。【结论】 融入近期投资者情感特征和股指特征的RoBERTa-TCN模型具有良好股价预测效果。

服务
把本文推荐给朋友
加入引用管理器
E-mail Alert
RSS
作者相关文章
严冬梅
何雯馨
陈智
关键词 股票预测情感特征RoBERTa时间卷积神经网络注意力机制    
Abstract

[Objective] Thisf paper aims to improve the prediction of stock prices with the help of investors’sentimental characteristics. [Methods] First, we constructed investors’ sentimental characteristics with the RoBERTa model and extracted the stock price characteristics with the TCN network. Then, we used the attention mechanism to merge these characteristics. Finally, we constructed the new RoBERTa-TCN model for stock price prediction. [Results] Compared with the experimental results of three models LSTM, GRU and TCN on six stock datasets, RoBERTa-TCN model has an average improvement of about 0.4906 on four different evaluation indicators. [Limitations] We did not examine the impacts of trading dates on the stock prices. [Conclusions] The RoBERTa-TCN model could effectively predict stock prices.

Key wordsStock Prediction    Sentimental Characteristics    RoBERTa    Temporal Convolutional Neural Network    Attention Mechanism
收稿日期: 2022-02-11      出版日期: 2023-02-03
ZTFLH:  TP393  
通讯作者: 严冬梅,ORCID:0000-0002-5300-9493     E-mail: ydongmei@tjufe.edu.cn
引用本文:   
严冬梅, 何雯馨, 陈智. 融合情感特征的基于RoBERTa-TCN的股价预测研究[J]. 数据分析与知识发现, 2022, 6(12): 123-134.
Yan Dongmei, He Wenxin, Chen Zhi. Predicting Stock Prices Based on RoBERTa-TCN and Sentimental Characteristics. Data Analysis and Knowledge Discovery, 2022, 6(12): 123-134.
链接本文:  
https://manu44.magtech.com.cn/Jwk_infotech_wk3/CN/10.11925/infotech.2096-3467.2022.0106      或      https://manu44.magtech.com.cn/Jwk_infotech_wk3/CN/Y2022/V6/I12/123
Fig.1  基于RoBERTa-TCN的股价预测模型流程图
Fig.2  因果卷积示意图
Fig.3  扩展卷积示意图
Fig.4  残差模块示意图
Fig.5  特征融合示意图
参数
批处理大小(batch_size) 8
迭代次数(epoch) 30
TCN网络深度(depth) 3
TCN卷积核大小(kernel size) 3
优化器 AdamW
Table 1  模型参数设置
名称 所属板块 所属行业
平安银行000001.sz 深市 金融服务
五粮液 000858.sz 深市 白酒
上汽集团600104.sh 沪市 汽车
伊利股份600887.sh 沪市 食品饮料
乐普医疗300003.sz 创业板 医药生物
亿纬锂能300014.sz 创业板 锂电池
Table 2  股票数据集统计
名称 数据量/条
平安银行000001.sz 98 444
五粮液 000858.sz 206 648
上汽集团600104.sh 125 404
伊利股份600887.sh 165 584
乐普医疗300003.sz 79 444
亿纬锂能300014.sz 94 421
Table 3  股评数据量统计
模型 评价指标 平安银行 五粮液 上汽集团 伊利股份 乐普医疗 亿纬锂能
LSTM MAE 3.625 3 3.106 0 2.572 0 2.483 2 2.667 3 5.531 8
RMSE 4.597 3 4.163 7 3.521 1 3.404 5 3.386 5 7.216 5
MAPE 5.261 1 4.080 2 13.683 3 3.752 5 5.965 1 8.686 3
R2 0.906 3 0.668 8 0.908 6 0.875 4 0.845 7 0.752 4
GRU MAE 2.900 4 2.533 7 2.141 0 2.401 9 2.263 7 2.263 7
RMSE 3.745 2 3.308 1 3.037 3 3.244 0 2.894 9 2.894 9
MAPE 4.079 4 3.330 2 10.935 5 3.592 6 5.023 6 5.023 6
R2 0.946 7 0.837 4 0.930 6 0.897 1 0.883 9 0.883 9
TCN MAE 2.743 6 2.073 2 2.342 7 2.337 1 2.224 5 2.974 3
RMSE 3.593 9 2.679 0 3.190 9 3.123 5 2.854 7 3.946 9
MAPE 3.964 3 4.572 4 12.367 2 3.525 6 4.992 8 4.824 4
R2 0.948 9 0.902 3 0.928 4 0.904 8 0.886 8 0.952 4
RoBERTa-LSTM MAE 0.626 1 0.436 4 0.865 6 0.833 8 0.847 8 0.563 6
RMSE 0.896 4 0.666 1 1.184 7 1.105 4 1.192 5 1.046 7
MAPE 0.486 0 0.375 6 0.583 6 0.704 8 0.618 2 0.215 0
R2 0.992 0 0.995 6 0.986 0 0.987 7 0.985 7 0.989 1
RoBERTa-GRU MAE 0.651 6 0.498 4 0.860 9 0.794 2 0.835 6 0.723 4
RMSE 0.877 3 0.661 5 1.170 4 1.111 1 1.165 1 1.035 5
MAPE 0.659 2 0.530 3 0.487 7 0.694 8 0.649 7 0.185 0
R2 0.992 3 0.995 6 0.986 3 0.987 5 0.986 4 0.989 3
RoBERTa-TCN MAE 0.625 0 0.402 6 0.836 0 0.766 4 0.826 4 0.533 7
RMSE 0.867 2 0.609 0 1.155 2 1.047 3 1.153 6 0.973 5
MAPE 0.422 7 0.215 9 0.542 9 0.693 9 0.609 8 0.164 8
R2 0.992 5 0.996 3 0.986 7 0.988 9 0.986 6 0.991 2
Table 4  各模型的实验预测指标对比
模型 评价指标 平安银行 五粮液 上汽集团 伊利股份 乐普医疗 亿纬锂能
RoBERTa-TCN(5) MAE 0.625 0 0.402 6 0.836 0 0.766 4 0.826 4 0.533 7
RMSE 0.867 2 0.609 0 1.155 2 1.047 3 1.153 6 0.973 5
MAPE 0.422 7 0.215 9 0.542 9 0.693 9 0.609 8 0.164 8
R2 0.992 5 0.996 3 0.986 7 0.988 9 0.986 6 0.991 2
RoBERTa-TCN(10) MAE 0.541 3 0.378 3 0.829 6 0.714 5 0.854 5 0.559 7
RMSE 0.785 7 0.572 4 1.145 2 1.016 3 1.165 2 0.975 0
MAPE 0.510 8 0.244 7 0.512 3 0.614 0 0.639 7 0.229 8
R2 0.993 8 0.996 7 0.986 9 0.989 5 0.986 3 0.990 6
RoBERTa-TCN(15) MAE 0.544 4 0.435 6 0.871 2 0.762 8 0.851 6 0.575 3
RMSE 0.808 6 0.622 4 1.188 8 1.055 4 1.183 6 0.988 4
MAPE 0.429 6 0.470 0 0.566 8 0.661 1 0.657 7 0.174 5
R2 0.993 5 0.996 1 0.985 9 0.988 6 0.985 8 0.990 3
Table 5  使用不同交易日情感均值的实验预测指标对比
模型 评价指标 平安银行 五粮液 上汽集团 伊利股份 乐普医疗 亿纬锂能
RoBERTa-TCN MAE 0.625 0 0.402 6 0.836 0 0.766 4 0.826 4 0.533 7
RMSE 0.867 2 0.609 0 1.155 2 1.047 3 1.153 6 0.973 5
MAPE 0.422 7 0.215 9 0.542 9 0.693 9 0.609 8 0.164 8
R2 0.992 5 0.996 3 0.986 7 0.988 9 0.986 6 0.991 2
RoBERTa-TCN-index MAE 0.560 1 0.314 0 0.816 3 0.726 5 0.862 9 0.511 0
RMSE 0.807 8 0.489 4 1.125 0 1.015 0 1.195 8 0.917 4
MAPE 0.462 5 0.224 7 0.512 9 0.736 6 0.780 4 0.176 9
R2 0.993 5 0.997 6 0.987 4 0.989 6 0.985 7 0.991 6
Table 6  模型加入股指的实验预测指标对比
[1] Hochreiter S, Schmidhuber J. Long Short-Term Memory[J]. Neural Computation, 1997, 9(8): 1735-1780.
doi: 10.1162/neco.1997.9.8.1735 pmid: 9377276
[2] Cho K, van Merrienboer B, Gulcehre C, et al. Learning Phrase Representations Using RNN Encoder-Decoder for Statistical Machine Translation[C]// Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing. 2014: 1724-1734.
[3] Bai S J, Kolter J Z, Koltun V. An Empirical Evaluation of Generic Convolutional and Recurrent Networks for Sequence Modeling[OL]. arXiv Preprint, arXiv: 1803.01271.
[4] 赵澄, 叶耀威, 姚明海. 基于金融文本情感的股票波动预测[J]. 计算机科学, 2020, 47(5): 79-83.
doi: 10.11896/jsjkx.190400145
[4] (Zhao Cheng, Ye Yaowei, Yao Minghai. Stock Volatility Forecast Based on Financial Text Emotion[J]. Computer Science, 2020, 47(5): 79-83.)
doi: 10.11896/jsjkx.190400145
[5] Chen K, Zhou Y, Dai F Y. A LSTM-Based Method for Stock Returns Prediction: A Case Study of China Stock Market[C]// Proceedings of the 2015 IEEE International Conference on Big Data. 2015: 2823-2824.
[6] Fischer T, Krauss C. Deep Learning with Long Short-Term Memory Networks for Financial Market Predictions[J]. European Journal of Operational Research, 2018, 270(2): 654-669.
doi: 10.1016/j.ejor.2017.11.054
[7] 裴大卫, 朱明. 基于多因子与多变量长短期记忆网络的股票价格预测[J]. 计算机系统应用, 2019, 28(8): 30-38.
[7] (Pei Dawei, Zhu Ming. Stock Price Prediction Based on Multiple-Factor and Multi-Variable Long Short Term Memory[J]. Computer Systems & Applications, 2019, 28(8): 30-38.)
[8] Kim T, Kim H Y. Forecasting Stock Prices with a Feature Fusion LSTM-CNN Model Using Different Representations of the Same Data[J]. PLoS One, 2019, 14(2): e0212320.
[9] 张倩玉, 严冬梅, 韩佳彤. 结合深度学习和分解算法的股票价格预测研究[J]. 计算机工程与应用, 2021, 57(5): 56-64.
doi: 10.3778/j.issn.1002-8331.2006-0444
[9] (Zhang Qianyu, Yan Dongmei, Han Jiatong. Research on Stock Price Prediction Combined with Deep Learning and Decomposition Algorithm[J]. Computer Engineering and Applications, 2021, 57(5): 56-64.)
doi: 10.3778/j.issn.1002-8331.2006-0444
[10] 陈禹帆, 温蜜, 张凯, 等. 基于相似日匹配及TCN-Attention的短期光伏出力预测[J]. 电测与仪表, 2022, 59(10): 108-116.
[10] (Chen Yufan, Wen Mi, Zhang Kai, et al. Short-Term Photovoltaic Output Forecasting Based on Similar Day Matching and TCN-Attention[J]. Electrical Measurement & Instrumentation, 2022, 59(10): 108-116.)
[11] 杨娟. 互联网财经新闻对股票影响的实证分析: 基于公司新闻语义分析的视角[D]. 成都: 西南财经大学, 2012.
[11] (Yang Juan. Empirical Analysis of the Impact of Internet Financial News on Stock: Analysis of Company News[D]. Chengdu: Southwestern University of Finance and Economics, 2012.)
[12] 赵亚南, 刘渊, 宋设. 融合多头自注意力机制的金融新闻极性分析[J]. 计算机工程, 2020, 46(8): 85-92.
[12] (Zhao Yanan, Liu Yuan, Song She. Financial News Polarity Analysis Fusing with Multi-Head Self-Attention Mechanism[J]. Computer Engineering, 2020, 46(8): 85-92.)
[13] 王婷, 杨文忠. 文本情感分析方法研究综述[J]. 计算机工程与应用, 2021, 57(12): 11-24.
doi: 10.3778/j.issn.1002-8331.2101-0022
[13] (Wang Ting, Yang Wenzhong. Review of Text Sentiment Analysis Methods[J]. Computer Engineering and Applications, 2021, 57(12): 11-24.)
doi: 10.3778/j.issn.1002-8331.2101-0022
[14] Ren R, Wu D D, Liu T X. Forecasting Stock Market Movement Direction Using Sentiment Analysis and Support Vector Machine[J]. IEEE Systems Journal, 2019, 13(1): 760-770.
doi: 10.1109/JSYST.2018.2794462
[15] Dong J H. Financial Investor Sentiment Analysis Based on FPGA and Convolutional Neural Network[J]. Microprocessors and Microsystems, 2020: 103418.
[16] Devlin J, Chang M W, Lee Kenton, et al. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding[OL]. arXiv Preprint, arXiv: 1810.04805.
[17] Munikar M, Shakya S, Shrestha A. Fine-Grained Sentiment Classification Using BERT[C]// Proceedings of 2019 Artificial Intelligence for Transforming Business and Society. 2019: 1-5.
[18] Liu Y H, Ott M, Goyal N, et al. BoBERTa: A Robustly Optimized BERT Pretraining Approach[OL]. arXiv Preprint, arXiv: 1907. 11692.
[19] Kaminski J. Nowcasting the Bitcoin Market with Twitter Signals[OL]. arXiv Preprint, arXiv: 1406.7577.
[20] 樊鹏英, 杨音, 张正平, 等. 个股投资者情绪与股票收益率的关系——基于股评信息视角的研究[J]. 数学的实践与认识, 2021, 51(16): 305-320.
[20] (Fan Pengying, Yang Yin, Zhang Zhengping, et al. The Relationship Between Individual Stock Investor Sentiment and the Stock Yield——Based on the Perspective of Stock Evaluation Information[J]. Mathematics in Practice and Theory, 2021, 51(16): 305-320.)
[21] 蔡启航. 媒体情绪对股票收益率的影响分析——基于自然语言处理和多因子模型的拓展研究[D]. 杭州: 浙江大学, 2021.
[21] (Cai Qihang. Analysis of the Influence of Media Sentiment on Stock Returns——An Extended Research Based on Natural Language Processing and Multi-Factor Models[D]. Hangzhou: Zhejiang University, 2021.)
[22] Jing N, Wu Z, Wang H F. A Hybrid Model Integrating Deep Learning with Investor Sentiment Analysis for Stock Price Prediction[J]. Expert Systems with Applications, 2021, 178: 115019.
doi: 10.1016/j.eswa.2021.115019
[23] Vargas M R, dos Anjos C E M, Bichara G L G, et al. Deep Learning for Stock Market Prediction Using Technical Indicators and Financial News Articles[C]// Proceedings of 2018 International Joint Conference on Neural Networks. 2018: 1-8.
[24] 徐月梅, 王子厚, 吴子歆. 一种基于CNN-BiLSTM多特征融合的股票走势预测模型[J]. 数据分析与知识发现, 2021, 5(7): 126-137.
[24] (Xu Yuemei, Wang Zihou, Wu Zixin. Predicting Stock Trends with CNN-BiLSTM Based Multi-Feature Integration Model[J]. Data Analysis and Knowledge Discovery, 2021, 5(7): 126-137.)
[25] Li X D, Wu P J, Wang W P. Incorporating Stock Prices and News Sentiments for Stock Market Prediction: A Case of Hong Kong[J]. Information Processing & Management, 2020, 57(5): 102212.
doi: 10.1016/j.ipm.2020.102212
[26] Kanavos A, Vonitsanos G, Mohasseb A, et al. An Entropy-Based Evaluation for Sentiment Analysis of Stock Market Prices Using Twitter Data[C]// Proceedings of 2020 15th International Workshop on Semantic and Social Media Adaptation and Personalization. 2020: 1-7.
[27] Ruder S, Peters M E, Swayamdipta S, et al. Transfer Learning in Natural Language Processing[C]// Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics:Tutorials. 2019: 15-18.
[28] Araci D. FinBERT: Financial Sentiment Analysis with Pre-trained Language Models[OL]. arXiv Preprint, arXiv: 1908.10063.
[29] Li M G, Li W R, Wang F, et al. Applying BERT to Analyze Investor Sentiment in Stock Market[J]. Neural Computing and Applications, 2021, 33(10): 4663-4676.
doi: 10.1007/s00521-020-05411-7
[30] Li M Z, Chen L, Zhao J, et al. Sentiment Analysis of Chinese Stock Reviews Based on BERT Model[J]. Applied Intelligence, 2021, 51(7): 5016-5024.
doi: 10.1007/s10489-020-02101-8
[31] van den Oord A, Dieleman S, Zen H G, et al. WaveNet: A Generative Model for Raw Audio[OL]. arXiv Preprint, arXiv: 1609.03499.
[32] He K M, Zhang X Y, Ren S Q, et al. Deep Residual Learning for Image Recognition[C]// Proceedings of 2016 IEEE Conference on Computer Vision and Pattern Recognition. 2016: 770-778.
[33] 杨浩东. 基于深度注意力机制的视频中人体动作识别[D]. 长沙: 国防科技大学, 2018.
[33] (Yang Haodong. Attention Mechanism Based Deep Network for Human Action Recognition in Video[D]. Changsha: National University of Defense Technology, 2018.)
[34] Vaswani A, Shazeer N, Parmar N, et al. Attention is All You Need[C]// Proceedings of the 31st International Conference on Neural Information Processing Systems. 2017: 6000-6010.
[35] Jin Z G, Yang Y, Liu Y H. Stock Closing Price Prediction Based on Sentiment Analysis and LSTM[J]. Neural Computing and Applications, 2020, 32(13): 9713-9729.
doi: 10.1007/s00521-019-04504-2
[1] 赵蕊洁, 佟昕瑀, 刘小桦, 路永和. 基于神经网络的医药科技论文实体识别与标注研究*[J]. 数据分析与知识发现, 2022, 6(9): 100-112.
[2] 唐娇, 张力生, 桑春艳. 基于潜在主题分布和长、短期用户表示的新闻推荐模型*[J]. 数据分析与知识发现, 2022, 6(9): 52-64.
[3] 赵鹏武, 李志义, 林小琦. 基于注意力机制和卷积神经网络的中文人物关系抽取与识别*[J]. 数据分析与知识发现, 2022, 6(8): 41-51.
[4] 张若琦, 申建芳, 陈平华. 结合GNN、Bi-GRU及注意力机制的会话序列推荐*[J]. 数据分析与知识发现, 2022, 6(6): 46-54.
[5] 叶瀚,孙海春,李欣,焦凯楠. 融合注意力机制与句向量压缩的长文本分类模型[J]. 数据分析与知识发现, 2022, 6(6): 84-94.
[6] 郭航程, 何彦青, 兰天, 吴振峰, 董诚. 基于Paragraph-BERT-CRF的科技论文摘要语步功能信息识别方法研究*[J]. 数据分析与知识发现, 2022, 6(2/3): 298-307.
[7] 徐月梅, 樊祖薇, 曹晗. 基于标签嵌入注意力机制的多任务文本分类模型*[J]. 数据分析与知识发现, 2022, 6(2/3): 105-116.
[8] 张云秋, 汪洋, 李博诚. 基于RoBERTa-wwm动态融合模型的中文电子病历命名实体识别*[J]. 数据分析与知识发现, 2022, 6(2/3): 242-250.
[9] 孟佳娜, 王晓培, 李婷, 刘爽, 赵迪. 基于对抗神经网络的跨模态谣言检测*[J]. 数据分析与知识发现, 2022, 6(12): 32-42.
[10] 范涛, 王昊, 张卫, 李晓敏. 基于机器阅读理解的非遗文本实体抽取研究*[J]. 数据分析与知识发现, 2022, 6(12): 70-79.
[11] 白思萌,牛振东,何慧,时恺泽,易坤,马原驰. 基于超图注意力网络的生物医学文本分类方法*[J]. 数据分析与知识发现, 2022, 6(11): 13-24.
[12] 黄学坚, 刘雨飏, 马廷淮. 基于改进型图神经网络的学术论文分类模型*[J]. 数据分析与知识发现, 2022, 6(10): 93-102.
[13] 谢星雨, 余本功. 基于MFFMB的电商评论文本分类研究*[J]. 数据分析与知识发现, 2022, 6(1): 101-112.
[14] 范涛,王昊,吴鹏. 基于图卷积神经网络和依存句法分析的网民负面情感分析研究*[J]. 数据分析与知识发现, 2021, 5(9): 97-106.
[15] 喻雪寒, 何琳, 徐健. 基于RoBERTa-CRF的古文历史事件抽取方法研究*[J]. 数据分析与知识发现, 2021, 5(7): 26-35.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
版权所有 © 2015 《数据分析与知识发现》编辑部
地址:北京市海淀区中关村北四环西路33号 邮编:100190
电话/传真:(010)82626611-6626,82624938
E-mail:jishu@mail.las.ac.cn