首页 > 解决方案 > 数据中 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 个时间戳来预测每个用户的下一个位置。

标签: pythonkerastime-serieslstm

解决方案


keras lstm 层输入是一个形状为 (batch_size, timesteps, input_dim) 的 3D 张量。从这里的文档https://keras.io/layers/recurrent/

因此,在您的情况下,它应该是 [batch_size, 480, 2] (如果 lstm 的唯一尺寸是 'slot' 和 'location' 变量。


推荐阅读