【问题标题】:explain model.fit in LSTM encoder-decoder with Attention model for Text Summarization using Keras /Tensorflow使用 Keras /Tensorflow 解释具有用于文本摘要的注意力模型的 LSTM 编码器-解码器中的 model.fit
【发布时间】:2020-12-29 14:39:33
【问题描述】:

在使用 Keras 进行深度学习时,我通常会遇到这样的 model.fit:

model.fit(x_train, y_train, epochs=50, callbacks=[es], batch_size=512, validation_data=(x_val, y_val)

而在 NLP 任务中,我看过一些关于使用 LSTM 编码器-解码器和注意力模型进行文本摘要的文章,我通常会遇到这段代码来拟合我无法理解的模型:

model.fit([x_tr,y_tr[:,:-1]], y_tr.reshape(y_tr.shape[0],y_tr.shape[1], 1)[:,1:] ,epochs=50,callbacks=[es],batch_size=512, validation_data=([x_val,y_val[:,:-1]], y_val.reshape(y_val.shape[0],y_val.shape[1], 1)[:,1:]))

而且我没有找到解释为什么要这样做。有人可以对上述代码进行解释。以上代码在https://www.analyticsvidhya.com/blog/2019/06/comprehensive-guide-text-summarization-using-deep-learning-python/

请注意:我已经联系了写这篇文章的人,但没有得到他的回复。

【问题讨论】:

    标签: python-3.x keras attention-model summarization encoder-decoder


    【解决方案1】:

    刚刚看到你的问题。无论如何,如果有人有类似的问题,这里是explanation

    model.fit() 方法来拟合训练数据,您可以在其中定义批量大小,例如你的情况是512。发送文本和摘要(不包括摘要中的最后一个单词)作为输入,并将包含每个单词(从第二个单词开始)的重构摘要张量作为输出(这解释了将智能注入模型以预测单词,给定前一个词)。此外,要在训练阶段启用验证,请同时发送验证数据。

    【讨论】:

      猜你喜欢
      • 2019-07-07
      • 2022-07-05
      • 2020-09-11
      • 1970-01-01
      • 2019-09-11
      • 1970-01-01
      • 2018-10-30
      • 2019-01-05
      • 1970-01-01
      相关资源
      最近更新 更多