情感分析:使用卷积神经网络

http://zh-v2.d2l.ai/chapter_natural-language-processing-applications/sentiment-analysis-cnn.html

image
这个地方说是用最大池化,但是用成平均的了

3 Likes

image

采用类似自然语言推断的bert微调的方法,对二分类进行bert微调,出现了过拟合。

作者的cnn结果也是过拟合,应该怎么修改呢?

现在是词的长度是宽,embedding长度是高吗?我以前看到的都是sequence_length x embedding_size,好困惑啊。还有

这上面说通道数=d???

对比了最大汇聚和平均汇聚,最大汇聚效果更好写,7个epoch下test acc 0.871

seems worse in case max pooling for me

some questions:

  1. in currently , both rnn and cnn solutions are poor.what’s the root cause? pertained model?
  2. I cut the classifier head in this model , then uses it to do compare ‘sentences similarity’ , it works.

原始输入序列形状为(batch, seq_len),经过嵌入层后形状为(batch, seq_len, embed_size),然后把embed_size这一维当成通道,所以对最后两个维度转置,形状变为(batch, embed_size, seq_len),现在上面说d维向量表示的n个词元,也就是seq_len=n,embed_szie=d,所以输入通道就是d了