python - 数据中 LSTM 的输入形状是什么?
问题描述
我有用户位置数据集,需要根据以前的数据预测用户的下一个位置。我选择使用 lstm 进行预测,但坚持塑造数据。
lstm 数据的输入形状应该是什么?
Total number of rows: 53398560
Total number of columns: 4
Columns: User, Timestamp, slot, Location
Users count: 111247
slot : [0-95] Each slot is the 15 mins of the timestamp.
2014-01-18 00:00:00 ----- 0
2014-01-18 23:45:00 ----- 95
No of timestamps for each user = 480 (96 slots * 5 days)
Location: Random points for each user
以上数据的 Xtrain、Ytrain、Xtest、Ytest 是什么。我需要根据 480 个时间戳来预测每个用户的下一个位置。
解决方案
keras lstm 层输入是一个形状为 (batch_size, timesteps, input_dim) 的 3D 张量。从这里的文档https://keras.io/layers/recurrent/
因此,在您的情况下,它应该是 [batch_size, 480, 2] (如果 lstm 的唯一尺寸是 'slot' 和 'location' 变量。
推荐阅读
- c# - 如何在 c# 中将 void* 转换为特定类型?
- python - Python Sockets - 连接了两个客户端套接字的服务器,在两个单独的线程上,重叠接收数据
- matlab - 如何为向量输入创建符号函数?
- python - gcc 5.2.0 的 boost.python 字符串兼容性
- visual-studio-code - VS Code:如何将命令面板永久粘贴到 UI
- java - 如何获得所有 Phone.DISPLAY_NAME_PRIMARY 和电话号码大小一次
- c# - 自定义设置器的行为类似于默认设置器
- python - python 从列表1中删除元素,如果它包含来自列表2的前缀
- r - 如何加速或并行化此 R 代码?
- oracle - 如何使用 ODP.NET Core 连接到 Oracle 9i 数据库 - 托管驱动程序