The link of paper: InteractiveAttentionNetworksforAspect-LevelSentimentClassification
Source: 2017IJCAI
Task: aspect level sentiment classification
Author: Jasminexjf
Time: 2019-06-24
参考:https://www.jianshu.com/p/0c9d987141b6
《Interactive Attention Networks for Aspect-Level Sentiment Classification》,这篇论文大致是讲利用attention机制将target和context联系起来,用于多层次语义分类。
多层次语义情感分类的解释是,如:
a group of friendly staff, the pizza is not bad, but the beef cubes are not worth the money!
这句话里,对staff,pizza, beef的情感是不同的,一句话里面的情感是多层次的。这三个名词都是target,这段话上下文就是是指context.
因此本文认为Aspect-level的情感分类任务中,target与context应该具有交互性,即context应该是target-specific的,target也应该是context-specific的,传统模型中将二者分开建模或只针对其一,本文利用attention实现二者交互。
Itroduction里面提到有些传统的做法,比如词袋,情感词库,SVM...这些方法都很容易遇到瓶颈,现在的做法一般都是利用深度学习进行多层次语义分析。
2011年的一篇论文解释了为何传统的方法会遇到很大的瓶颈(40% errors),主要是因为之前的方法都没有有效的利用target信息。之后就有大量论文关注target的作用,但是这些论文都忽视了target与context的相互之间的关系。
作者的观点是:In our opinion, only the coordination of targets and their contexts can really enhance the performance of sentiment classification.
例子:
“The picture quality is clear-cut but the battery life is too short“
“Short fat noodle spoon, relatively deep some curva”
很显然,在上个context上下文short对于target battery是负面的,下面一个context上下文中,short对于target spoon是中性的.
所以结合short与具体的context的关系才能得到正确的语义情感分类。
那么,应该如何建模?
从框架图分析论文设计的IAN模型的构造,target和context两方面分别输入相应的word embeddings,再将word embeddings的结果输入到LSTM网络中,获得隐藏层输出,再利用target和context隐藏层的输出平均值,结合attetion机制,生成attention weights. 最终target attention weights和context attention weights串联起来作为softmax函数的输入,得到分类结果。
1. word embedding
本文的word embedding采用的是预先训练好的词向量,一般是采用大语料库进行训练得到的初始词向量作为初始向量,然后在后续的训练过程中进行fine-tune.
2. LSTM
3. 得到初始的target和context表示
方法就是平均所有的隐藏层数值:
4. attention 机制
其中,cr和tr就是target和context的最终向量表示
5. softmax分类器
先将cr和tr串联,然后加权和输入tanh,再将结果输入softmax,根据概率最大的得出属于的情感倾向:
6.模型训练
模型训练需要训练的参数包括LSTM的参数,attention中分数函数的[Wa,ba], [Wt,bt ]softmax层的 [Wl,bl]和word embedding.
损失函数用的是带L2正则项的交叉熵函数。
然后反向传播开始训练, 为防止过拟合,使用dropout.
IA方法与之前的几种方法对比,效果提升明显
超参数设置:
sentence:the fish is fresh but the variety of fish is noting out of ordinary.
这句话有两个target "fish"和"variety of fish"
下图展示了IAN计算的target与context对应的attention weights:
颜色越深的attention weights值越大,可以看出:
之后有一篇论文比这篇效果更好《Aspect Level Sentiment Classification with Deep Memory Network》,原因可能是它用了多次hop,提取到了更抽象的内容,本篇论文只做了一次attention,学习到的东西有限。