【发布时间】:2017-08-10 21:08:13
【问题描述】:
给定 X 尺寸为 (m 个样本,n 个序列和 k 个特征),以及 y 个尺寸为 (m样本,0/1):
假设我想训练一个有状态的 LSTM(按照 keras 的定义,其中“有状态 = True”意味着在每个样本的序列之间不会重置单元状态——如果我错了,请纠正我!),应该是状态以每个时期或每个样本为基础进行重置?
例子:
for e in epoch:
for m in X.shape[0]: #for each sample
for n in X.shape[1]: #for each sequence
#train_on_batch for model...
#model.reset_states() (1) I believe this is 'stateful = False'?
#model.reset_states() (2) wouldn't this make more sense?
#model.reset_states() (3) This is what I usually see...
总之,我不确定是否在每个序列或每个 epoch 之后重置状态(在所有 m 个样本都在 X 中训练之后)。
非常感谢您的建议。
【问题讨论】:
标签: python machine-learning keras lstm recurrent-neural-network