吉林大学学报(工学版) ›› 2025, Vol. 55 ›› Issue (5): 1664-1674.doi: 10.13229/j.cnki.jdxbgxb.20230845

• 计算机科学与技术 • 上一篇    下一篇

基于知识蒸馏和评论时间的文本情感分类新方法

王友卫1(),刘奥1,凤丽洲2   

  1. 1.中央财经大学 信息学院,北京 100081
    2.天津财经大学 统计学院,天津 300222
  • 收稿日期:2023-08-09 出版日期:2025-05-01 发布日期:2025-07-18
  • 作者简介:王友卫(1987-),男,副教授,博士. 研究方向:内容安全,深度学习,数据挖掘.E-mail:ywwang15@126.com
  • 基金资助:
    中央财经大学科研创新团队支持计划项目(202516);中央财经大学新兴交叉学科建设项目(202106);天津市教委科研计划项目(2023SK115);国家社科一般项目(20BTJ058)

New method for text sentiment classification based on knowledge distillation and comment time

You-wei WANG1(),Ao LIU1,Li-zhou FENG2   

  1. 1.School of Information,Central University of Finance and Economics,Beijing 100081,China
    2.School of Statistics,Tianjin University of Finance and Economics,Tianjin 300222,China
  • Received:2023-08-09 Online:2025-05-01 Published:2025-07-18

摘要:

针对现有的情感分类方法普遍未能充分考虑用户个性化特征且忽略时间因素对情感分类结果的影响的问题,提出一种基于知识蒸馏和评论时间的文本情感分类新方法。首先,为解决数据集中高质量标注数据较少的问题,采用RoFormer-Sim生成模型对训练文本数据增强;然后,引入评论时间属性,从用户历史评论中提取用户的个性化信息,提出基于多特征融合的评论文本情感得分预测模型;最后,为提高针对冷启动用户的泛化性能,引入知识蒸馏理论,利用SKEP模型对基于多特征融合的情感分类模型进行通用性增强。在从中文股吧爬取的真实数据集上的实验结果表明:与SKEP、ELECTRA等典型方法相比,本文方法在准确率上分别提高了3.1%和0.9%,在F1值上分别提高了2.7%和1.0%,验证了其在改善情感分类表现方面的有效性。

关键词: 计算机应用, 情感分类, 知识蒸馏, 数据增强, 历史评论

Abstract:

Aiming at the problem that the existing sentiment classification methods generally did not fully consider the user's personalized characteristics and ignore the influence of time factor on the sentiment classification results, a new method for text sentiment classification based on knowledge distillation and comment time is proposed. Firstly, in order to solve the problem of less labeled data with high quality, the RoFormer-Sim generative model is used to augment the training text data. Then, a sentiment score prediction model of comment text based on multi-feature fusion is proposed by introducing comment time attribute to extract users' personalized information from user's historical comments. Finally, in order to improve the generalization performance for cold start users, the knowledge distillation theory is introduced, and SKEP model is used to enhance the versatility of the sentiment classification model based on multi-feature fusion. The experimental results on the real dataset crawled from the Chinese stock page show that compared with typical methods such as SKEP and ELECTRA, the accuracy of the proposed method is improved by 3.1% and 0.9%, and the F1 value is increased by 2.7% and 1.0%, respectively, which verifies its effectiveness in improving the performance of sentiment classification.

Key words: computer application, sentiment classification, knowledge distillation, data augmentation, historical comment

中图分类号: 

  • TP391.1

表1

本文主要符号及含义"

符号含 义
wordkijUijP分词、去停用词等操作后的第k个词
hijkW∈R mwordkij对应的词向量
hijS∈R mUijP的句向量
hiL∈R m用户i的历史评论向量
hiF∈R m+n用户i的特征向量
hiA∈R n用户i的属性向量
hijC∈R m+n用户当前评论UijC的句向量
hiR∈R m+n用户i的关系向量
N用户总数
m词向量的维数

图1

本文方法整体框架"

表2

用户评论示例"

用户名标题+正文情感标记发表时间
股友3663E5w329储能最差的股!盛洪是储能板块最差的,前面走过几倍了,是不可能拉升02021/09/17
芝加哥夜鹰这个股价是不可能回头了,唉,郁闷呢。大帝一出手,股市抖三抖02021/09/11
未来可期30721涨停无疑了,连板股,吃大肉[微笑]12021/05/26
漫步冥王星塔牌这一跌,跌得没头没脑。另一方面来看,很好的进货机会12021/04/28
松松雪7856已经大举加仓。锁仓!关电脑12021/04/2
喉喉喉喉369这货踏踏实实跌,主力底下等着吶,黑庄,这股就是笑话02021/02/1

表3

不同方法的主要参数设置"

分类方法准确率
BiGRU16BiGRU层数num_bigru=1
BiGRU+Attention19BiGRU维度dim_bigru=100
TextCNN20

卷积核尺寸filter_size=3,4,5

卷积核数量num_kernel=100

ALBERT2albert_small_zh_google模型
ELECTRA21electra_180g_small模型
SKEP9ernie_1.0_skep_large_ch模型
CAT-BiGRU22词向量维数word2vec_size=200
句子最大长度max_len=20
Cov-Att-Bilstm23BiLSTM层数num_bilstm=2
CNN+BiGRU24卷积核尺寸filter_size=2,3,4,5
卷积核数量num_kernel=100
LSTM-GRU25词向量维数word2vec_size=200
MFMS温度系数T=3,权重因子a=0.7

图2

数据增强倍数及测试集对分类表现的影响"

图3

数据增强倍数及测试集对运行时间的影响"

图4

训练中各损失值、准确率和F1值的变化趋势"

图5

带时间属性的用户个性特征有效性验证"

表4

与典型深度学习方法的准确率、F1和RMSE值比较"

分类方法准确率F1RMSE
BiGRU0.8300.8810.412
BiGRU+Attention0.8340.8820.407
TextCNN0.8260.8820.418
ALBERT0.8410.8850.397
ELECTRA0.8570.8980.379
SKEP0.8350.8810.406
CAT-BiGRU0.8120.8680.433
Cov-Att-BiLSTM0.8240.8780.419
CNN+BiGRU0.8410.8900.398
LSTM-GRU0.7990.8560.449
MFM0.8550.9000.380
MFMS0.8660.9080.366

表5

不同方法对应的准确率、F1值"

分类方法准确率F1
SKEP0.8350.881
MFMS-NRel0.8580.901
MFMS-Attr0.8620.903
MFMS-DW0.8600.903
MFM0.8500.896
MFMS0.8630.905

图6

不同方法在SST-2上的准确率、F1值"

[1] Umer M, Sadiq S, Nappi M, et al. ETCNN: extra tree and convolutional neural network-based ensemble model for COVID-19 tweets sentiment classification[J]. Pattern Recognition Letters, 2022, 164: 224-231.
[2] Lan Z, Chen M, Goodman S, et al. ALBERT: a lite bert for self-supervised learning of language representations[C]∥International Conference on Learning Representations, Addis Ababa, Ethiopia, 2020: 1-17.
[3] Liu Z, Huang D, Huang K, et al. Finbert: a pre-trained financial language representation model for financial text mining[C]∥Proceedings of the Twenty-Ninth International Conference on International Joint Conferences on Artificial Intelligence, Yokohama, Japan, 2021: 4513-4519.
[4] 赵亚欧, 张家重, 李贻斌, 等. 基于ELMo和Transformer混合模型的情感分析[J]. 中文信息学报, 2021, 35(3): 115-124.
Zhao Ya-ou, Zhang Jia-chong, Li Yi-bin, et al. Sentiment analysis based on hybird model of elmo and transformer[J]. Journal of Chinese Information Processing, 2021, 35(3): 115-124.
[5] Yang J, Zou X, Zhang W, et al. Microblog sentiment analysis via embedding social contexts into an attentive LSTM[J]. Engineering Applications of Artificial Intelligence, 2021, 97: 104048.
[6] 蒋宗礼, 张静. 融合用户和产品信息的多头注意力情感分类模型[J]. 计算机系统应用, 2020, 29(7): 131-138.
Jiang Zong-li, Zhang Jing. Multi-head attention model with user and product information for sentiment classification[J]. Computer Systems & Applications, 2020, 29(7): 131-138.
[7] Hinton G, Vinyals O, Dean J. Distilling the knowledge in a neural network[J]. Computer Science, 2015, 14(7): 38-39.
[8] 邵仁荣, 刘宇昂, 张伟, 等. 深度学习中知识蒸馏研究综述[J]. 计算机学报, 2022, 45(8): 1638-1673.
Shao Ren-rong, Liu Yu-ang, Zhang Wei, et al. A survey of knowledge distillation in deep learning[J]. Chinese Journal of Computers, 2022, 45(8): 1638-1673.
[9] Tian H, Gao C, Xiao X, et al. SKEP: sentiment knowledge enhanced pre-training for sentiment analysis[J/OL]. [2023-07-25].arXiv Preprint arXiv: 2005. 05635v2.
[10] Turney P D. Thumbs up or thumbs down? Semantic orientation applied to unsupervised classification of reviews[J]. Association for Computational Linguistics, 2002, 6: 417-424.
[11] Xie W. Entity linking based on roformer-sim for chinese short texts[J]. Frontiers in Computing and Intelligent Systems, 2023, 4(1): 46-50.
[12] Zhao Y, Liu S, Zhang Q, et al. Test case classification via few-shot learning[J]. Information and Software Technology, 2023, 160:107228.
[13] Lewis M, Liu Y, Goyal N, et al. BART: denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension[C]∥Meeting of the Association for Computational Linguistics. Association for Computational Linguistics, 2020: 7871-7880.
[14] Ebbinghaus H. Memory: a contribution to experimental psychology[J]. Annals of Neurosciences, 2013, 20(4): 2004155.
[15] Grover A, Leskovec J. Node2vec: scalable feature learning for networks[C]∥Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, New York, USA, 2016: 855-864.
[16] 乔百友, 武彤, 杨璐, 等. 一种基于BiGRU和胶囊网络的文本情感分析方法[J]. 吉林大学学报: 工学版, 2024,54(7): 2026-2037.
Qiao Bai-you, Wu Tong, Yang Lu, et al. A text sentiment analysis method based on BiGRU and capsule network[J]. Journal of Jilin University (Engineering and Technology Edition), 2024, 54(7): 2026-2037.
[17] 王友卫, 童爽, 凤丽洲, 等. 基于图卷积网络的归纳式微博谣言检测新方法[J].浙江大学学报: 工学版, 2022, 56(5): 956-996.
Wang You-wei, Tong Shuang, Feng Li-zhou, et al. New inductive microblog rumor detection method based on graph convolutional network[J]. Journal of Zhejiang University (Engineering Science), 2022, 56(5): 956-996.
[18] 陈洁, 王思雨, 赵姝, 等. 基于多粒度用户偏好的文档级情感分析[J]. 中文信息学报, 2023, 37(7): 122-130.
Chen Jie, Wang Si-yu, Zhao Shu, et al. Multi-granular user preferences for document-level sentiment analysis[J]. Journal of Chinese Information Processing, 2023, 37(7): 122-130.
[19] Li Y, Ni P, Li G, et al. Inter-personal relation extraction model based on bidirectional GRU and attention mechanism[C]∥IEEE 5th International Conference on Computer and Communications (ICCC), Harbin, China, 2019: 1867-1871.
[20] Guo B, Zhang C, Liu J, et al. Improving text classification with weighted word embeddings via a multi-channel textcnn model[J]. Neurocomputing, 2019, 363: 366-374.
[21] Clark K, Luong M T, Le Q V, et al. Electra: pre-training text encoders as discriminators rather than generators[J/OL]. [2023-07-26]. arXiv Preprint arXiv: 2003. 10555.
[22] Kamal A, Abulaish M. Cat-bigru: convolution and attention with bi-directional gated recurrent unit for self-deprecating sarcasm detection[J]. Cognitive Computation, 2022, 14: 91-109.
[23] Ahmad W, Wang B, Martin P, et al. Enhanced sentiment analysis regarding COVID-19 news from global channels[J]. Journal of Computational Social Science, 2023, 6: 19-57.
[24] Gao Z, Li Z, Luo J, et al. Short text aspect-based sentiment analysis based on CNN + BiGRU[J]. Applied Sciences, 2022, 12(5): 12052707.
[25] Aslam N, Rustam F, Lee E, et al. Sentiment analysis and emotion detection on cryptocurrency related tweets using ensemble LSTM-GRU model[J]. IEEE Access, 2022, 10: 39313-39324.
[1] 侯越,郭劲松,林伟,张迪,武月,张鑫. 分割可跨越车道分界线的多视角视频车速提取方法[J]. 吉林大学学报(工学版), 2025, 55(5): 1692-1704.
[2] 赵宏伟,周明珠,刘萍萍,周求湛. 基于置信学习和协同训练的医学图像分割方法[J]. 吉林大学学报(工学版), 2025, 55(5): 1675-1681.
[3] 申自浩,高永生,王辉,刘沛骞,刘琨. 面向车联网隐私保护的深度确定性策略梯度缓存方法[J]. 吉林大学学报(工学版), 2025, 55(5): 1638-1647.
[4] 王军,司昌馥,王凯鹏,付强. 融合集成学习技术和PSO-GA算法的特征提取技术的入侵检测方法[J]. 吉林大学学报(工学版), 2025, 55(4): 1396-1405.
[5] 徐涛,孔帅迪,刘才华,李时. 异构机密计算综述[J]. 吉林大学学报(工学版), 2025, 55(3): 755-770.
[6] 赵孟雪,车翔玖,徐欢,刘全乐. 基于先验知识优化的医学图像候选区域生成方法[J]. 吉林大学学报(工学版), 2025, 55(2): 722-730.
[7] 蔡晓东,周青松,张言言,雪韵. 基于动静态和关系特征全局捕获的社交推荐模型[J]. 吉林大学学报(工学版), 2025, 55(2): 700-708.
[8] 车翔玖,武宇宁,刘全乐. 基于因果特征学习的有权同构图分类算法[J]. 吉林大学学报(工学版), 2025, 55(2): 681-686.
[9] 郭晓然,王铁君,闫悦. 基于局部注意力和本地远程监督的实体关系抽取方法[J]. 吉林大学学报(工学版), 2025, 55(1): 307-315.
[10] 汪豪,赵彬,刘国华. 基于时间和运动增强的视频动作识别[J]. 吉林大学学报(工学版), 2025, 55(1): 339-346.
[11] 刘元宁,臧子楠,张浩,刘震. 基于深度学习的核糖核酸二级结构预测方法[J]. 吉林大学学报(工学版), 2025, 55(1): 297-306.
[12] 李路,宋均琦,朱明,谭鹤群,周玉凡,孙超奇,周铖钰. 基于RGHS图像增强和改进YOLOv5网络的黄颡鱼目标提取[J]. 吉林大学学报(工学版), 2024, 54(9): 2638-2645.
[13] 赵宏伟,武鸿,马克,李海. 基于知识蒸馏的图像分类框架[J]. 吉林大学学报(工学版), 2024, 54(8): 2307-2312.
[14] 张云佐,郑宇鑫,武存宇,张天. 基于双特征提取网络的复杂环境车道线精准检测[J]. 吉林大学学报(工学版), 2024, 54(7): 1894-1902.
[15] 孙铭会,薛浩,金玉波,曲卫东,秦贵和. 联合时空注意力的视频显著性预测[J]. 吉林大学学报(工学版), 2024, 54(6): 1767-1776.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
[1] 彭亚平,郭英男,黄为钧,谭满志,董磊,王志伟 . 乙醇燃料均质压燃的燃烧循环变动[J]. 吉林大学学报(工学版), 2007, 37(02): 301 -0306 .
[2] 高峰;黄河;任露泉 . 新疆岩蜥三元耦合耐冲蚀磨损特性及其仿生试验[J]. 吉林大学学报(工学版), 2008, 38(03): 586 -0590 .
[3] 寇淑清,乔健,皮文皓,杨慎华 . 滚花连接的中空凸轮轴装配过程影响因素分析
[J]. 吉林大学学报(工学版), 2008, 38(02): 323 -0328 .
[4] 徐云飞,金振华,卢青春,闫东林 . 能量混合型燃料电池城市客车
系统设计与性能测试
[J]. 吉林大学学报(工学版), 2007, 37(02): 296 -0300 .
[5] 周立军, 王殿海, 李卫青. 人工神经网络及粒子群优化算法在跟驰模型中的应用[J]. 吉林大学学报(工学版), 2009, 39(04): 896 -899 .
[6] 王祺,胡坚明,王易之,张毅. 一种基于车间通信的交通信息采集方法[J]. 吉林大学学报(工学版), 2009, 39(增刊2): 7 -0012 .
[7] 金磊,王冰,李春媛,张平. 基于迭代的时分同步码分多址系统终端误差矢量值一致性测试算法[J]. 吉林大学学报(工学版), 2006, 36(02): 253 -0258 .
[8] 李陆,郭庆,管明祥,井庆丰 . 基于跨层设计的卫星MAC协议[J]. 吉林大学学报(工学版), 2008, 38(06): 1458 -1462 .
[9] 叶玉玲,伞冶 . 一种混合优化算法及其性能[J]. 吉林大学学报(工学版), 2009, 39(01): 131 -136 .
[10] 张立斌, 苏建, 单洪颖, 田永军, 刘苏超. 轮胎印迹压电式汽车轴距差检测误差补偿方法[J]. 吉林大学学报(工学版), 2011, 41(02): 327 -0332 .