out = TimeDistributed(LSTM(cells,return_sequences=True))(out)
#you may add more
让我们保持 return_sequences = True ,因为您希望模型末尾的步数非常相似 .
在某些时候,让's collapse the 4214 dimension, placing it at the end, as if it were the time steps (or even as if it were features - risky, but a lot less risky than 23312 features). Here, since they'独立, Bidirectional 包装器可能会派上用场:
out = Permute((2,1,3))(out)
1 - 如果您选择4214步骤:
#you can use one or more layers with return_sequences=True before this one
out = TimeDistributed(Bidirectional(LSTM(cells,return_sequences=False)))(out)
2 - 如果您选择4214功能:
#remove the last dimension which was 1
out = Reshape((22312,4214))
#no need to care about they being a sequence, no TimeDistributed, no Bidirectional.
out = LSTM(cells,return_sequences=True)(out)
#the return_sequences=True here relates to the 22312 steps
#but you need to go back to 1 feature per step:
out = Reshape((22312,1))(out)
1 回答
很有可能它可以在完全卷积模型中工作,你必须在任何类型的压扁/密集之前消除空间尺寸 . 但是因为有太多的卷积只有相同的数据,所以它似乎不是最好的想法....
而且由于你想要一个22311结果的输出,可能LSTM方法(考虑一个不同的变量是第一个)将是最有用的....
An LSTM model:
在第一次尝试时,您可以尝试非状态LSTM模型 .
但是不要像上一个维度是功能一样工作(20000个功能将创建许多参数的方式)!好像他们是时间步骤一样工作 .
逐步转换功能可能会使模型更难以理解 . 另一方面,如果你不这样做,你的记忆总会爆发 . 但是,如果一个不同的数据是第一步,那么所有以下(和重复的)数据很有可能获得一些额外的含义 .
所以,首先,我们只重塑一个功能:
现在,让我们尝试一个技巧,使其好像是一个序列序列,添加TimeDistributed包装器(这允许增加维度):
让我们保持
return_sequences = True
,因为您希望模型末尾的步数非常相似 .在某些时候,让's collapse the 4214 dimension, placing it at the end, as if it were the time steps (or even as if it were features - risky, but a lot less risky than 23312 features). Here, since they'独立,
Bidirectional
包装器可能会派上用场:1 - 如果您选择4214步骤:
2 - 如果您选择4214功能:
现在4214尺寸已经崩溃,现在一切都像
(batchSize, 22312, 1)
那样形成了一个序列 . 由于我们不再是4D,而是3D,我们可以放弃TimeDistributed包装器:最后,使用lambda图层丢弃此序列的第一个元素(只是为了匹配您想要的输出):