Journal of Computer Applications ›› 2025, Vol. 45 ›› Issue (9): 2773-2782.DOI: 10.11772/j.issn.1001-9081.2024081193

• Artificial intelligence • Previous Articles    

Multi-scale feature fusion sentiment classification based on bidirectional cross attention

Yiming LIANG1,2,3, Jing FAN1,2,3(), Wenze CHAI1,2,3   

  1. 1.College of Electrical and Information Technology,Yunnan Minzu University,Kunming Yunnan 650504,China
    2.Yunnan Key Laboratory of Unmanned Autonomous Systems (Yunnan Minzu University),Kunming Yunnan 650504,China
    3.Key Laboratory of Information and Communication on Security Backup and Recovery in Universities of Yunnan Province (Yunnan Minzu University),Kunming Yunnan 650504,China
  • Received:2024-08-26 Revised:2024-12-03 Accepted:2024-12-10 Online:2024-12-17 Published:2025-09-10
  • Contact: Jing FAN
  • About author:LIANG Yiming, born in 1997, M. S. candidate. His research interests include natural language processing, sentiment analysis.
    CHAI Wenze, born in 1998, M. S. candidate. His research interests include deep learning.
  • Supported by:
    Youth Fund of Ministry of Education Humanities and Social Sciences Foundation(20YJCZH129);Yunnan Wu Zhonghai Expert Workstation(202305AF150045);China University Innovation Fund — New Generation of Information Technology Innovation Project(2023IT077);Educational Instruments and Facilities Service Center of Educational Department of Yunnan Province

基于双向交叉注意力的多尺度特征融合情感分类

梁一鸣1,2,3, 范菁1,2,3(), 柴汶泽1,2,3   

  1. 1.云南民族大学 电气信息工程学院,昆明 650504
    2.云南省无人自主系统重点实验室(云南民族大学),昆明 650504
    3.云南省高校信息与通信安全灾备重点实验室(云南民族大学),昆明 650504
  • 通讯作者: 范菁
  • 作者简介:梁一鸣(1997—),男,河南商丘人,硕士研究生,CCF会员,主要研究方向:自然语言处理、情感分析
    柴汶泽(1998—),男,山西朔州人,硕士研究生,CCF会员,主要研究方向:深度学习。
  • 基金资助:
    教育部人文社会科学研究青年基金资助项目(20YJCZH129);云南省吴中海专家工作站项目(202305AF150045);云南省教育厅教学仪器装备中心项目;教育部-新一代信息技术创新项目(2023IT077)

Abstract:

Aiming at limitations of the existing sentiment classification models in deep sentiment understanding, unidirectional constraints of traditional attention mechanisms, and class imbalance problem in Natural Language Processing (NLP), a sentiment classification model M-BCA (Multi-scale BERT features with Bidirectional Cross Attention) was proposed that integrates multi-scale BERT (Bidirectional Encoder Representations from Transformers) features and a bidirectional cross attention mechanism. Firstly, multi-scale features were extracted from BERT’s lower, middle, and upper layers to capture surface information, syntactic information, and deep semantic information of sentence texts. Secondly, a three-channel Gated Recurrent Unit (GRU) was utilized to further extract deep semantic features, thereby enhancing the model’s understanding ability of text. Finally, in order to promote interaction and learning between different scale features, a bidirectional cross attention mechanism was introduced, thereby strengthening interaction between multi-scale features. Additionally, to address imbalanced data issue, a data augmentation strategy was designed, and a mixed loss function was adopted to optimize the model’s learning for minority class samples. Experimental results indicate that excellent performance is achieved by M-BCA in fine-grained sentiment classification tasks. M-BCA performs significantly better than most baseline models when dealing with imbalanced multi-class sentiment datasets. Moreover, M-BCA has outstanding performance in classifying minority class samples, particularly on NLPCC 2014 and Online_Shopping_10_Cats datasets, where the Macro-Recall of M-BCA for minority classes surpasses that of all of the comparison models. It can be seen that this model achieves remarkable performance enhancements in fine-grained sentiment classification tasks and is suitable for handling imbalanced datasets.

Key words: BERT (Bidirectional Encoder Representations from Transformers), fine-grained sentiment classification, multi-scale feature fusion, data augmentation, mixed loss function, bidirectional cross attention

摘要:

针对现有情感分类模型在深层情感理解上的局限性、传统注意力机制的单向性束缚以及自然语言处理NLP)中的类别不平衡等问题,提出一种融合多尺度BERT(Bidirectional Encoder Representations from Transformers)特征和双向交叉注意力机制的情感分类模型M-BCA(Multi-scale BERT features with Bidirectional Cross Attention)。首先,从BERT的低层、中层和高层分别提取多尺度特征,以捕捉句子文本的表面信息、语法信息和深层语义信息;其次,利用三通道门控循环单元(GRU)进一步提取深层语义特征,从而增强模型对文本的理解能力;最后,为促进不同尺度特征之间的交互与学习,引入双向交叉注意力机制,从而增强多尺度特征之间的相互作用。此外,针对不平衡数据问题,设计数据增强策略,并采用混合损失函数优化模型对少数类别样本的学习。实验结果表明,在细粒度情感分类任务中,M-BCA表现优异。M-BCA在处理分布不平衡的多分类情感数据集时,它的性能显著优于大多数基线模型。此外,M-BCA在少数类别样本的分类任务中表现突出,尤其是在NLPCC 2014与Online_Shopping_10_Cats数据集上,M-BCA的少数类别的Macro-Recall领先其他所有对比模型。可见,该模型在细粒度情感分类任务中取得了显著的性能提升,并适用于处理不平衡数据集。

关键词: BERT, 细粒度情感分类, 多尺度特征融合, 数据增强, 混合损失函数, 双向交叉注意力

CLC Number: