zoukankan      html  css  js  c++  java
  • keras中 LSTM 的 [samples, time_steps, features] 最终解释

    I am going through the following blog on LSTM neural network:http://machinelearningmastery.com/understanding-stateful-lstm-recurrent-neural-networks-python-keras/

    The author reshapes the input vector X as [samples, time steps, features] for different configuration of LSTMs.

    The author writes

    Indeed, the sequences of letters are time steps of one feature rather than one time step of separate features. We have given more context to the network, but not more sequence as it expected

    What does this mean?

    =========================================

    I found this just below the [samples, time_steps, features] you are concerned with.

    X = numpy.reshape(dataX, (len(dataX), seq_length, 1))
    

    Samples - This is the len(dataX), or the amount of data points you have.

    Time steps - This is equivalent to the amount of time steps you run your recurrent neural network. If you want your network to have memory of 60 characters, this number should be 60.

    Features - this is the amount of features in every time step. If you are processing pictures, this is the amount of pixels. In this case you seem to have 1 feature per time step.

    ASK:

    can you explain the difference between : X = numpy.reshape(dataX, (len(dataX), 3, 1)) and X = numpy.reshape(dataX, (len(dataX), 1, 3)) How does this affect the lstm?

    ANSWER:

    (len(dataX), 3, 1) runs LSTM for 3 iterations, inputting a input vector of shape (1,). (len(dataX), 1, 3) runs LSTM for 1 iteration. Which means that it is quite useless to even have recurrent connections since there can't be any feedback from previous iterations. In this case input shape to RNN is of shape (3,)。

    其实TimeSteps就是unfold的意思,就是tensorflow中的 NUM_STEPS 的意思。

    Features其实就是输入的维度,也就是特征,一个维度一个特征。

    The LSTM networks are stateful. They should be able to learn the whole alphabet sequence, but by default the Keras implementation resets the network state after each training batch.

    LSTM网络本是状态传递的,这种网络本应该是学习整个序列的; 但是keras的默认实现却会在每个batch训练结束时重置网络的状态。

  • 相关阅读:
    激活函数(ReLU, Swish, Maxout)
    损失函数
    md5sum命令行使用注意事项
    Jetson ARM SeetaFace编译
    Linux下的wine生活(QQ/微信/Office)
    人脸识别引擎SeetaFace编译 ubuntu
    Python为8bit深度图像应用color map
    MySQL、MongoDB、Redis数据库Docker镜像制作
    bash的管道符与重定向
    Docker 及 nvidia-docker 使用
  • 原文地址:https://www.cnblogs.com/welhzh/p/6857409.html
Copyright © 2011-2022 走看看