【问题标题】:Sentiment classifier training with Keras使用 Keras 进行情感分类器训练
【发布时间】:2018-08-28 16:55:32
【问题描述】:

我正在使用 keras(后端 tensorflow)对来自亚马逊评论的情绪进行分类。

它从嵌入层(使用 GloVe)开始,然后是 LSTM 层,最后是 Dense 层作为输出。模型摘要如下:

_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
embedding_1 (Embedding)      (None, None, 100)         2258700   
_________________________________________________________________
lstm_1 (LSTM)                (None, 16)                7488      
_________________________________________________________________
dense_1 (Dense)              (None, 5)                 85        
=================================================================
Total params: 2,266,273
Trainable params: 2,266,273
Non-trainable params: 0
_________________________________________________________________
Train on 454728 samples, validate on 113683 samples

训练时 train 和 eval 准确率约为 74%,损失(train 和 eval)约为 0.6。

我尝试过改变 LSTM 层中的元素数量,包括 dropout、recurrent dropout、regularizer 和 GRU(而不是 LSTM)。然后准确率提高了一点(~76%)。

我还可以尝试什么来改善我的结果?

【问题讨论】:

    标签: tensorflow keras text-classification


    【解决方案1】:

    我在使用双向 LSTM 的情感分析方面取得了更大的成功,也垂直堆叠了两层,即 2 个 LSTMS 一起形成了一个深度网络,也有助于尝试将 lstm 元素的数量增加到 128 个左右。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-11
      • 2021-01-20
      • 2011-01-25
      • 2019-05-17
      • 1970-01-01
      • 2019-11-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多