我有这样的时间序列数据
feat1 feat2 target
date id
0 1 12 16 192
2 15 6 90
3 2 9 18
1 1 0 3 0
2 0 9 0
3 56 9 504
2 1 5 9 45
2 6 9 54
3 5 8 40我的问题是回归。
关于LSTM序列,我知道的是,通常情况下,row_id是日期,所以您构建了n行序列。
在我的数据中,正如你所看到的,这是不同的。在引用日期的每一行中,我还有3行表示产品。
我思考过的问题的顺序,我的sequence将是2天:
sequence = [day0,day1],[day1,day2]每一个date,我都有
date0 = [id1,id2,id3].对于每一个id,我都有:
id = [feat1,feat2].sequence[0],就像
[
[
[12,16],
[15,6],
[2,9]
],[
[0,3],
[0.9],
[56,9]
]
]这有效吗?
LSTM层会理解这一点吗?还是我必须做些额外的改变?
发布于 2019-04-13 15:21:31
您的数据格式是
feature1 feature2 target
product1 1 12 2
timestamp product2 2 6 3
product3 4 3 4有两种假设的设计:
X(t) = [feature1, feature2],或者,包括目标X(t)|y(t) = [feature1, feature2, target]。我们分别为每种产品建立了一个模型。总之,LSTM为t-1和t接收两个1x3序列,并为t + 1输出一个1x1目标。表示法:(\overbrace{X_{t-1}|y_{t-1}}^{1 \times 3}, \overbrace{X_{t}|y_{t}}^{1 \times 3}) \rightarrow \overbrace{y_{t+1}}^{1 \times 1}product1可以帮助product2预测其目标。为此,我们只需要将3x2矩阵平平成一个1x6向量,其中值的顺序并不重要。即,X(t) = product1_feature1,product1_feature2,.,product3_feature2或X(t) = product1_feature1,product2_feature1,.,product3_feature2,我们也可以添加目标,例如X(T)\y(T)= product1_feature1,product2_feature1,.,product3_feature2,target1,.,target3,这样,每个时间戳的维数将为9 (6 + 3),两个时间戳的序列将是[ product1_feature1,product2_feature1,.,product3_feature2,target1,.,target3,# t-1 product1_feature1,product2_feature1,.,product3_feature2,target1,.,target3 #t],对应于t + 1的三维目标[target1, ..., target3]。总之,LSTM为t-1和t接收两个1x9序列,并为t + 1输出一个1x3目标。表示法:(\overbrace{X_{t-1}|y_{t-1}}^{1 \times 9}, \overbrace{X_{t}|y_{t}}^{1 \times 9}) \rightarrow \overbrace{y_{t+1}}^{1 \times 3}https://datascience.stackexchange.com/questions/49236
复制相似问题