Keras 中的递归神经层

Recurrent neural layers in Keras

我正在通过 Keras 学习神经网络,并想在循环神经网络上探索我的顺序数据集。 我是 reading the docs and trying to make sense of the LSTM example

我的问题是:

  1. 两层都需要什么timesteps
  2. 如何准备使用 Dense 作为那些循环层的输入的顺序数据集?
  3. Embedding层是做什么的?
  1. 对于 Keras,时间步长是一个非常令人烦恼的事情。由于您作为 LSTM 输入提供的数据必须是一个 numpy 数组,因此需要(至少对于 Keras 版本 <= 0.3.3)具有指定的数据形状 - 即使 "time"尺寸。您只能将具有指定长度的序列作为输入 - 如果您的输入长度不同 - 您应该使用人工数据 "fill" 您的序列或使用 "stateful" 模式(请仔细阅读 Keras 文档以了解此方法的含义)。这两种解决方案都可能令人不快 - 但 Keras 如此简单是您付出的代价 :) 我希望在 1.0.0 版中他们会对此有所作为。

  2. 有两种方法可以在 LSTM 层之后应用非当前层:

    • 您可以将参数 return_sequences 设置为 False - 然后只有每个序列的最后激活将被传递到 "static" 层。
    • 您可以使用 "time distributed" 层之一 - 以更灵活地处理数据。
  3. https://stats.stackexchange.com/questions/182775/what-is-an-embedding-layer-in-a-neural-network :)