Affect-LM: A Neural Language Model for Customizable Affective Text Generation
原先的LSTM求下一个单词的概率公式:
其中,f(.)是LSTM的输出结果。现在更改(加入情感能量项)如下:
β表示情感强度,可以从0(中性,基线模型)到β=∞(生成的句子只由情感色彩的单词组成,没有语法结构)
表示从上文学到的词向量,g()表示属于哪种情感,例[1,0,1,1,0]
表示第i个词和g()的相似度,g() * 如果大说明第i个词跟g()情感一致,故p()的值大。
怎么学到的?
LIWC而来
which is obtained by binary thresholding of the features extracted from LIWC
The affect category et 1 is
processed by a multi-layer perceptron with a single hidden layer of 100 neurons and sigmoid activation function to yield g(et 1).
g()函数是什么?
感知机训练而来
g(.) is the output of a network operating on 。
怎么得到?
训练而来
is an embedding learnt by the model for the i-th word in the vocabulary
矩阵Vi的每一行是第i个词在词汇中的情感上有意义的词向量
Vi是由模型学习的词汇中的第i个词的词向量,预期会对有区别的表达每个单词的情感信息。
Affect-LM学习权重矩阵V,其捕获预测词wt与影响类别et-1之间的相关性。
模型(自己画的):
代码参考:https://github.com/gupett/Re-implementation-of-Affect-LM