一种基于嵌入式注意力机制的文本分类方法
2020-08-13熊宽



摘 要: 大數据时代海量的文本数据蕴含着极大的科研价值,文本分类技术得到广泛的关注。文本分类在信息检索、自动问答等应用领域占据重要地位,是自然语言处理研究的关键技术之一。本文针对神经网络分类方法训练时间长性能仍可提高,提出一种嵌入式注意力机制模块(Eam),用来增强已有的文本分类神经网络模型。该模块将重点关注数据中什么是最有意义及哪里含有的信息量更为丰富,从而高效提取文本中有价值的信息区域加速模型收敛。本文以增强TextCNN、ImdbCNN为例,在公开数据集IMDB上证明Eam的有效性,同等参数配置情况下能够提升模型的准确率、召回率及F1值,较原模型能够更快收敛减少训练时间。
关键词: 文本分类;神经网络;注意力机制;TextCNN
中图分类号: TP391.1 文献标识码: A DOI:10.3969/j.issn.1003-6970.2020.06.036
本文著录格式:熊宽. 一种基于嵌入式注意力机制的文本分类方法[J]. 软件,2020,41(06):171176
【Abstract】: The huge amount of text data in the era of big data contains great scientific research value, and the text classification technology has received widespread attention. Text classification occupies an important position in the fields of information retrieval, automatic question answering and other applications, and is one of the key technologies in natural language processing research. Aiming at the long training time performance of neural network classification method, this paper proposes an embedded attention mechanism module (Eam) to enhance the existing neural network model of text classification. This module will focus on what is most meaningful in the data and where the amount of information is more abundant, so as to efficiently extract valuable information areas in the text and accelerate model convergence. This paper takes Enhanced TextCNN and ImdbCNN as examples, and proves the validity of Eam on the public dataset IMDB. It can improve the accuracy, recall and F1 value of the model under the same parameter configuration, which can converge faster and reduce the training time than the original model.
【Key words】: Text classification; Neural Networks; Attention mechanism; TextCNN
0 引言
文本分类(Text Categorization)是指依据文本的内容,由计算机根据某种自动分类算法,把文本判分为预先定义好的类别[1]。文本分类是自然语言处理(NLP)领域中一项具有挑战性的任务,它在情感分类、自动问答、舆情分析等领域具有广泛的应用[2]。
传统的文本分类方法主要根据文本与类别标签的相关性来对文本进行标签,该标签根据统计指标估算。例如,词袋模型[3]计算共现词的出现频率,n元语法模型[4]计算单词对的频率,而TF-IDF模型[5]计算不同文档中每个单词的权重得分。
上述基于统计的方法不仅丢失了词序信息,而且存在数据稀疏和维数灾难问题。……
