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训练结束时重置网络的状态。
keras中 LSTM 的 [samples, time_steps, features] 最终解释的更多相关文章
- 基于 Keras 用 LSTM 网络做时间序列预测
目录 基于 Keras 用 LSTM 网络做时间序列预测 问题描述 长短记忆网络 LSTM 网络回归 LSTM 网络回归结合窗口法 基于时间步的 LSTM 网络回归 在批量训练之间保持 LSTM 的记 ...
- 在Keras中可视化LSTM
作者|Praneet Bomma 编译|VK 来源|https://towardsdatascience.com/visualising-lstm-activations-in-keras-b5020 ...
- Keras实现LSTM
一.先看一个Example 1.描述,输入为一个字母,输出为这个字母的下一个顺序字母 A->B B->C C->D 2.Code import numpy from keras.mo ...
- keras中的loss、optimizer、metrics
用keras搭好模型架构之后的下一步,就是执行编译操作.在编译时,经常需要指定三个参数 loss optimizer metrics 这三个参数有两类选择: 使用字符串 使用标识符,如keras.lo ...
- (数据科学学习手札44)在Keras中训练多层感知机
一.简介 Keras是有着自主的一套前端控制语法,后端基于tensorflow和theano的深度学习框架,因为其搭建神经网络简单快捷明了的语法风格,可以帮助使用者更快捷的搭建自己的神经网络,堪称深度 ...
- Deep Learning 32: 自己写的keras的一个callbacks函数,解决keras中不能在每个epoch实时显示学习速率learning rate的问题
一.问题: keras中不能在每个epoch实时显示学习速率learning rate,从而方便调试,实际上也是为了调试解决这个问题:Deep Learning 31: 不同版本的keras,对同样的 ...
- Keras中图像维度介绍
报错问题: ValueError: Negative dimension size caused by subtracting 5 from 1 for 'conv2d_1/convolution' ...
- 为何Keras中的CNN是有问题的,如何修复它们?
在训练了 50 个 epoch 之后,本文作者惊讶地发现模型什么都没学到,于是开始深挖背后的问题,并最终从恺明大神论文中得到的知识解决了问题. 上个星期我做了一些实验,用了在 CIFAR10 数据集上 ...
- keras中VGG19预训练模型的使用
keras提供了VGG19在ImageNet上的预训练权重模型文件,其他可用的模型还有VGG16.Xception.ResNet50.InceptionV3 4个. VGG19在keras中的定义: ...
随机推荐
- 1 App Components - App组件
Android应用框架可以让你使用一系列可重用的组件来创建极其丰富和新颖的应用.本节说明了Android应用如何工作,如何使用组件来创建应用. Managing the Activity Lifecy ...
- Node.js 配置Nginx
1.修改nginx.conf upstream nodejs { server 127.0.0.1:3000; #server 127.0.0.1:3001; keepalive 64; } serv ...
- maven将依赖打入jar包并制定main方法
<build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId& ...
- matlab和C/C++混合编程--Mex (转载)
matlab和C/C++混合编程--Mex 最近的项目需要matlab和C的混合编程,经过一番努力终于完成了项目要解决的问题.现在就将Mex的一些经验总结一下,当然只是刚刚开始,以后随着学习的深入继续 ...
- linux—jdk 安装步骤
1. 查看现有版本 java -version 2. 查看jdk的具体版本 rpm –qa| grep jdk rpm –qa| grep gcj 3. ...
- Tuning 04 Sizing the Buffer Cache
Buffer Cache 特性 The buffer cache holds copies of the data blocks from the data files. Because the bu ...
- 安装vm虚拟机
1.本次win10系统安装vmware workstation 下载地址:http://www.ihacksoft.com/vmware-workstation-10-0-4.html 2.镜像使用 ...
- String.Join
在指定 String 数组的每个元素之间串联指定的分隔符 String,从而产生单个串联的字符串.(来源于MSDN) 有两个重载函数:[C#]public static string Join( ...
- 【BZOJ】2020: [Usaco2010 Jan]Buying Feed, II (dp)
http://www.lydsy.com/JudgeOnline/problem.php?id=2020 和背包差不多 同样滚动数组 f[j]表示当前位置j份食物的最小价值 f[j]=min(f[j- ...
- ORACLE 10g RAC [ CSSCLNT][1]clsssInitNative: connect failed, rc 9
"[ CSSCLNT][1]clsssInitNative: connect failed, rc 9“是Oracle RAC中经常遇到的问题,主要出现在安装过程和启动过程中.经常在$ORA ...