基于双向LSTM模型的文本情感分类

发布时间:2023-05-07 20:44:04   来源:文档文库   
字号:
20187 第 39 卷
7 期
COMPUTERENGINEERINGANDDESIGN
July 2018Vol. 39 No.
7基于双向LSTM模型的文本情感分类,甘+(成都信息工程大学网络空间安全学院,四610225摘要"为解决文本情感分类研究中传统循环神经网络模型存在梯度消失和爆炸问题,提出一种基于双向长短时记忆循环 神经网络模型(Bi-LSTM通过双向传播机制获取文本中完整的上下文信息,采用CBOW模型训练词向量,减小词向量 间的稀疏度,结合栈式自编码深度神经网络作为分类器。实验结果表明,Bi-LSTM模型比传统循环神经网络LSTM型分 类效果更好,对比实验中Bi-LSTM2能达到更优的召回率和准确率。关键词:双向长短时记忆循环神经网络&词向量;长短时记忆网络&循环神经网络;文本情感倾向性分析 中图法分类号 TP391.1 文献标识号:A 文章编号:1000-7024 (2018
07-2064-05 doi: 10. 16208'. issnl000-7024. 2018. 07. 044Sentiment analysis of text based on bi-directional long short-term memory modelREN Mian, GAN Gang+(College of Cybersecurity, Chengdu University of Information Technology, Chengdu 610225, ChinaAbstract To solve the sentiment analysis, a
problems of gradient neural
network model
disappearance based
and
explosion in long
the
traditional memory
on bi-directional short-term (Bi-LSThe bi-directional mechanism was used to obtain the complete context information in the text, and the continuous bag of words model was used to train the word vector to reduce the sparseness between the word vectors, and the s tack sel--coding depth neu­ral ne twork was used as
the classifier. Experimental results
show
that
theBi-LSTM model
isbetteneural ne twork LSTM model, and the Bi-LSTM2 can achieve better recall rate and accuracy.Key words Bi-LSTM word vec t or long shor - term memory recurrent neural networks sentiment analysis of text/
[16]。 & 广YongZhang %] , Bolan su%] long short-term memory, LSTM %0], 收稿日期:2017-06-08;修订日期:2017-08-05基金项目:国家重大科技专项基金项目(2014ZX01032401-001 , bi-directional long short-term memory, Bi- LSTM 1相关工作CBOW 1. 1
CBOW (continuous bag of words 1]CBOW CBOWwcontoKw, W,ccrn^cKw,w w NEG(w,作者简介:1992-,女,四川广元人,硕士研究生,研究方向为数据挖掘、网络舆情、信息安全;d通讯作者:1974 -) 男,四川茂县人,硕士,教授,授研究方向为网络与信息系统安全、云计算与大数据安全、网络舆情。E-mail: test_me@qq.com
397:基LSTM 2065 R1
=JX

(
-CBOWgi10
3
1
2 BI-LSTM模型设计(1
2.1 两种LSTM变型( "
(^ wBEEGwPu JContexti(' (2lstm-peephole lstm-peephole2LSTM peephole connection
piu J(X^du,Lw(u
=
1 Context iw

=

a(XduLw (F 3"
0(1.2 LSTMLSTM RNN [12]。1LSTM%3&使 1zt^ GLSTMz7’的 a6 w。,w_Sc Cell/g&
(3 =zzCt = ta-(nh(W^cx %t %#—Uch1 %1 % tbc (4ztWxtUb
(5 / = ( 1 taWfXt%Ufh%bf
(6 zt /,QGtCt = it # Ct % ft # Ct-1
(7
-(" W0xt %U#—1 %V0Ct%b0
(8
%415]。peepho(
sigmoid Sigmoid1] 0“禁”,1 “允”。 “中-“北 9G-1G-1 Xt01G-1 ft = a(Wf [C^—1 ,h1 Xt] %bf (90i " -(i .[G—1#—1x] %b
(10G-1G G-1zt
= # 1 % #
CtftCztCt
(11 0 " -( 0\_
tW Ctyh1 yxt]%b
(12cell sigmoid tanh11sigmoid
(2 coupled6&使coupled
2066 32018 3 coupled遗忘门和输入门
在未 间段输 的值到已经忘记的旧信息的状态位置处Ct = ft # Ct-i % (1 一 ft #
(138 2Bi-LSTM模型的情感倾向性分类模型设计LSTM
向循环网络的情感倾向性分
3Bi-LSTM神经网络分 4:词 ,需要
地学习

,通常,一

,将
,即把每一,此CBOW:采Bi-LSTM
,同 LSTM在后续的 Bi-LSTM,采LSTM:通
,同 。这
的信息Kt = H(W$:xt
%Whhht-1 %b^

(14
得到不同方向yt = Hyht
%Whyht
% by
(15 %7]栈式
2个隐 softmax3TensorFlowTensorFlow使
流式 Word使TensorFlow
2vecBi-LSTMLSTM
LSTM
LSTM-peepholeLSTMcoupled Bi-LSTMLSTM测试双向 网络结构对分类的影响3.1实验数据Github及到

616 0004000
其中10 00010 000 15 0005000条3.2参数调整使CBOW用少
的目标
用编Negative Sampling这种 loss function方法 K过调 来调整参数50200通过
120F55
成不能产
因此词频阈 520如图 6 Bi-LSTM
397:基LSTM 2067 5基于词向量维度增长的F值变化dd 87 6 d 5 4 3

d d
d

6基于窗口大小增长的准确率值变化实验过程中,发现使用LSTM模型时,迭代次数到5之后
损失值维持不变,而Bi-LSTM在迭代次数到10时损失值
维持不变,7所示。d8d76d5d4d32d1dd1 2 3 4 5 6 7 8 9 10 11 12 13 14 15迭代次数LSTM -m-
Bi-LSTM7基于迭代次数增加损失值变化最后分类器训练结果是一个[0, 1]区间的连续的实 而程序的在默认的情况下将0.5设置为阈值因此最 后将大于0. 5的值判断为正0. 5的结果判断为负 3.3实验结果分析本实验通过两组对比实验YSTM的两种变型结 Bi-LSTM模型之间的评价指标数据先第一 用不同的LSTM单元结构进行对比,第一组LSTM变型结构是LSTM-peephole连接模型另一 coupled遗忘门和输入门在下表中分别称为Bi-LSTM-1 Bi-LSTM-2,见表 1第二组对比实验是通过分析标准LSTMBi-LSTM 间的差异21LSTM对比模型结构准确率召回率Bi-LSTM-10.75210. 7415Bi-LSTM-20.82360. 81252 LSTMBi-LSTM对比型结构LSTM0.78590. 7654Bi-LSTM0.84210. 8658下面对实验结果数据进行分析(1根据第一组的对比实验看LSTM结构的两种变 型运用在情感分类的语言模型中第二种模型使用coupled 遗忘门和输入门的结构有较高的准确率"从第二组对比实验来看使用双向循环神经网络 对只使用单LSTM结构准 要高说明使用 文信息之间 同时考虑时序 的这种方式能够更好地解决文本情感倾向性分 4结束语本文在总结之间的文本情感分类基础上提出一种Bi-
LSTM 语言模型来完成对文本倾向性 的分类 通过 列向前和向后的两 经网络得到完整的过 来的上下文信息通过实验对比不同的LSTM变型结构
结合深度神经网络分 更好地完成分类任务得到双向网络结构能更好地解
文联系的 同时也有待完善的部分如在语料的 需要对比不同语料的分类情况来完善模型
续的工
进这一部分并研究不同的分类器构造方法
参考文献:[1] XING Yunfei. Research on the characteristics and path of net­work public opinion information transmission inmobile environ­ment [D]. Changchun Jilin University 2016 (in Chinese.
[邢
.
[D].2016.]%] HU Gaili Chen Ting CHEN Fuji. A literature review on the network of public opinion in China [J]. Information Science
2016 34 (1 160-166 (in Chinese.[,陈',陈 集.[J].2016, 34 (1 160-166.][3] Chun Liao, Chong Feng Sen Yang. Topic-related
Chinese message sentiment analysis [J]. Neurocomputing 2016
210 (1 237-246[4] Chen Tao, Xu Ruifeng Yang Sen. Improving sentiment anal­ysis via sentence type classification using BiLSTM-CRF and CNN [J]. Expert Systems with Applications 2016 72
2068
2018 (10: 221-230.[5] Fu Xinghua, LiuWangwangXuYingying, Combine
HowNet lexicon to train phrase recursive autoencoder for sentence-level sentiment analysis [J], Neurocomputing 2017, 241 (79:nectionist language models in improving LSTM-based Arabic text recognition in videos [J], Pattern Recognition
2017,41 (5:
245-254.[13] Chen Tao, Rui Feng He Yulan. Improving sentiment analy­sis via sentence type classification using BiLSTM-CRF
and CNN [J], Expert Systems with Application 2017,
72 18-27.[6] Meng JE YongZ Ning W. Attention pooling-based convolu­tional neur-1 network for sentence modelling [J],
Information Sciences2016,373 (4: 388-403,(15: 221-231.[14] Greff K Srivastava K Koutnik J. LSTM A search
space odyssey [J], IEEE Transactions on Neural Networks and Learning Systems 2017 (99: 1-11.[7] Su B Lu Shijian Chu Chingyun. Accurate recognition of words in scenss without character segmentation using recurrent neural ne--
work [J]. Pattern Recogniton 2017, 34 (1: 397-405.[8] Taft M Xu J Chowdhury V. Letter coding in visual
wordrecognition The impact of embedded words [J], Journal of Memory and Language 2017, 25 (2: 14-25.[15] Nogueira C Stanos D GattiR, Deep convolutional
neural networks for sentiment analysis [C] //25th
International Conference on Computational. Ireland Technical Papers
[9] Liao Chun Yang Sen Huang Heyan. Topic-related
Chinese message sentiment analysis [J], Neurocomputing 2016,
142014: 23-29.[16] Wei JiameiPeiE,Jiang Dongmei,
Multimodal
continuous affect recognition based on LSTM and multiple kernll
learning (10: 237-246.[10] Ren Yafeng WangRuimin,Ji Donghong. A
topic-enhanced word embedding for Twitter sentiment classification [J]. Electronic Letters 2016, 10 (11:
188-198.[C] //Sigml and Information Processing Association Annuli Summit and Conference. Piscataway NJ IEEE 2014:
1-4.[17] Severyn A Moschitti A Chu Chingyun.
Learning to
rank text pairs w ith convolutionalal. short FaDA Fattdocument deep neural
network [11] Lohar P Ganguly D AfliH,et
aligner using word embedding [J]. Prague Bulletin of Mathe-
maticll Linguistics 2016, 106 (1: 169-179.[C] //38th International ACM SIGIRConference on
Research and Development in Information Retrievll Symposium on Cir­cuits and Systems. Newyork ACM2015 373-382.[12] Yousfi S,Berrani S Garcia C. Contribution of recurrent con-(上2063[11] LI Qingwu QIU Chunchun YU Kaiet al. Rell time pe­destrian detection based on multi-scale aggregation channel £ea- turss [J], Journll of Electronic Measurement and Instrumen­tation 2015,29 (11: 1691-1697 (inChinese[13] Ba LJ Frey B. Adaptive dropout for training deep neunl ne--
works [J]. Advances in Neural Information Processing Sys­tems 2013:
3084-3092..[李庆武, [14] Jia Y Shelhamer E Donahue J et al. Caffe
Convolutional architecture for fast feature embedding [C] //Proceedings of the 22nd ACM International Conference on Multimedia. ACM2014: 675-678.仇春春,俞措,等.基于多尺度聚合通道特征的实时行人检测 [].2015, 29 (1: 1691-1697.][12] Rothe R Guillaumin M Van Gool L.
dows [CNon-maximum sup­pression for objett detection by passing messagss between win­] //Asian Conference on Computer Vision. Sprin­[15] Dollar P Wojek C Schiele B et al. Pedestrian detection
Anevaluation of the state of the art [J], IEEE Transactions on Pa--temAnalysisQ Machine Intelligence2012, 34 (4: 743-761.ger Cham 2014: 290-306.

本文来源:https://www.2haoxitong.net/k/doc/670eef59750bf78a6529647d27284b73f242369c.html

《基于双向LSTM模型的文本情感分类.doc》
将本文的Word文档下载到电脑,方便收藏和打印
推荐度:
点击下载文档

文档为doc格式