资料来自keras源码。

关于units的源码解释如下:

units: Positive integer, dimensionality of the output space.

self.output_size = self.units

def output_size(self):

"""Integer or TensorShape: size of outputs produced by this cell."""

raise NotImplementedError('Abstract method')

outputsize的解释:

- A `state_size` attribute. This can be a single integer

(single state) in which case it is the size of the recurrent

state. This can also be a list/tuple of integers (one size per

state).

The `state_size` can also be TensorShape or tuple/list of

TensorShape, to represent high dimension state.

- A `output_size` attribute. This can be a single integer or a

TensorShape, which represent the shape of the output. For backward

compatible reason, if this attribute is not available for the

cell, the value will be inferred by the first element of the

`state_size`.

An RNN cell, in the most abstract setting, is anything that has

a state and performs some operation that takes a matrix of inputs.

This operation results in an output matrix with `self.output_size` columns.

If `self.state_size` is an integer, this operation also results in a new

state matrix with `self.state_size` columns. If `self.state_size` is a

(possibly nested tuple of) TensorShape object(s), then it should return a

matching structure of Tensors having shape `[batch_size].concatenate(s)`

for each `s` in `self.batch_size`.

"""An "LSTM with 50 neurons" or an "LSTM with 50 units" basically means that the dimension of the output vector, h, is 50.

关于timesteps的源码解释如下:

input_shape = K.int_shape(inputs)

timesteps = input_shape[0] if time_major else input_shape[1]

input shape解释:

Input shape:

N-D tensor with shape `(batch_size, timesteps, ...)` or

`(timesteps, batch_size, ...)` when time_major is True.

output shape解释:

Output shape:

- If `return_state`: a list of tensors. The first tensor is

the output. The remaining tensors are the last states,

each with shape `(batch_size, state_size)`, where `state_size` could

be a high dimension tensor shape.

- If `return_sequences`: N-D tensor with shape

`(batch_size, timesteps, output_size)`, where `output_size` could

be a high dimension tensor shape, or

`(timesteps, batch_size, output_size)` when `time_major` is True.

- Else, N-D tensor with shape `(batch_size, output_size)`, where

`output_size` could be a high dimension tensor shape.

K解释:

"""Turn a nD tensor into a 2D tensor with same 0th dimension.

In other words, it flattens each data samples of a batch.

Arguments:

x: A tensor or variable.

Returns:

A tensor.

Examples:

Flattening a 3D tensor to 2D by collapsing the last dimension.

```python

>>> from tensorflow.keras import backend as K

>>> x_batch = K.ones(shape=(2, 3, 4, 5))

>>> x_batch_flatten = K.batch_flatten(x_batch)

>>> K.int_shape(x_batch_flatten)

(2, 60)

```

"""

time_major解释:

time_major: The shape format of the `inputs` and `outputs` tensors.

If True, the inputs and outputs will be in shape

`(timesteps, batch, ...)`, whereas in the False case, it will be

`(batch, timesteps, ...)`. Using `time_major = True` is a bit more

efficient because it avoids transposes at the beginning and end of the

RNN calculation. However, most TensorFlow data is batch-major, so by

default this function accepts input and emits output in batch-major

form.The timestep in essence is the number of units (seconds/minutes/hours/days/frames in a video etc.) which is used to predict the future step(s).

keras lstm参数 中_keras LSTM中参数问题:timesteps和units相关推荐

  1. keras实现简单lstm_深度学习(LSTM)在交通建模中的应用

    上方点击蓝字关注? 在简单了解了LSTM原理之后,本期我将以航班延误预测为例为大家介绍一下如何利用Python编程来构建LSTM模型. 这里我们要用到一个高级的深度学习链接库--Keras,它以Ten ...

  2. keras中一个LSTM的具体例子

    keras中一个LSTM的具体例子 LSTM:long short-term memory-保存信息以便后面使用,从而防止较早期的信号在处理过程中逐渐消失.SimpleRNN并不是Keras中唯一可用 ...

  3. lstm模型java实现_如何在Keras中构建LSTM分类器模型

    你想做的是: from keras.models import Sequential from keras.layers import LSTM, Dense from keras.optimizer ...

  4. Python中利用LSTM模型进行时间序列预测分析

    时间序列模型 时间序列预测分析就是利用过去一段时间内某事件时间的特征来预测未来一段时间内该事件的特征.这是一类相对比较复杂的预测建模问题,和回归分析模型的预测不同,时间序列模型是依赖于事件发生的先后顺 ...

  5. python 预测任意天后股票数据_在Python中使用LSTM进行股票市场预测

    本文概述 在本教程中, 你将看到如何使用称为长短期记忆的时间序列模型. LSTM模型功能强大, 特别是通过设计保留了长期记忆, 这一点将在以后看到.你将在本教程中解决以下主题: 了解为什么你需要能够预 ...

  6. 在Python中使用LSTM和PyTorch进行时间序列预测

    全文链接:http://tecdat.cn/?p=8145 顾名思义,时间序列数据是一种随时间变化的数据类型.例如,24小时内的温度,一个月内各种产品的价格,一年中特定公司的股票价格(点击文末&quo ...

  7. 从Tensorflow代码中理解LSTM网络

    目录 RNN LSTM 参考文档与引子 缩略词  RNN (Recurrent neural network) 循环神经网络  LSTM (Long short-term memory) 长短期记忆人 ...

  8. 【深度学习】在PyTorch中使用 LSTM 自动编码器进行时间序列异常检测

    写在前面 环境准备 本次数据集的格式.arff,需要用到arff2pandas模块读取. # !nvidia-smi # !pip install -qq arff2pandas # !pip ins ...

  9. 【深度学习】在PyTorch中使用 LSTM 进行新冠病例预测

    时间序列数据,顾名思义是一种随时间变化的数据.例如,24 小时时间段内的温度,一个月内各种产品的价格,特定公司一年内的股票价格.长短期记忆网络(LSTM)等高级深度学习模型能够捕捉时间序列数据中的模式 ...

最新文章

  1. kettlejava脚本的api_Java调用自己开发的Kettle plugin插件
  2. 最优化方法外罚函数法Matlab,最优化方法 第三篇(罚函数法).pdf
  3. Python----面向对象---自定义元类控制类的实例化行为的应用
  4. oracle select 变量_详解oracle数据库优化参数--cursor_sharing
  5. 漫画:Bitmap算法
  6. [2018.11.03 T1] 游戏攻略
  7. Face Recognition 库-人脸识别
  8. TI公司CC系列的各种芯片的区别 CC2430 CC1100
  9. hive基本用法及细节记录
  10. 1484: 青蛙(四)
  11. 如何将二维码巧妙放进海报里?
  12. c/c++的改错练习二
  13. CAD编辑工具中如何查找图纸中的坐标点的位置
  14. CSS实现图片自适应布局
  15. 春哥博客 - Day01 - Python基础之print
  16. qps、tps、吞吐量
  17. java自动违例设计,Java违例控制总结
  18. 2021年全球切削刀具市场销售额达到了244.5亿美元,预计2028年将达到321亿美元
  19. 2022年度湖北省科技创新人才及服务专项软科学研究项目申报条件、流程和项目类别
  20. 创业知识(四):打造超强执行力团队(转载)

热门文章

  1. 第一个显卡满了,导致不能用其他显卡的解决方案
  2. VS2017写C++时报错 表达式必须包含指向对象的指针类型
  3. 求教专业人士,视频的码率多少合适?是不是和分辨率、帧率有关?
  4. SLIC超像素分割详解
  5. 建立自己的voc数据集_将自己数据集转化成voc数据集格式并用mmdetection训练
  6. 用Python写一段代码,用来操作鼠标点击
  7. Htc Vive Sdk(OpenVR),Unity3d 开发,手柄射线
  8. MyEclipse 使用技巧
  9. #学习笔记#什么是Http协议
  10. 侠客风云传ol未能连接服务器,《侠客风云传online》8月31日服务器数据互通公告...