假设您在时间序列中缺少值,例如:
t1 x1 y1
t2 ? ?
t3 x3 y3
t4 ? ?
t5 x5 y5
您正在尝试使用循环神经网络(例如 LSTM)预测此时间序列,并决定使用掩码处理缺失值。
Masking example (from Keras): set x[:, 3, :] = 0. and x[:, 5, :] = 0. - insert a Masking layer with mask_value=0. before the LSTM layer: model = Sequential() model.add(Masking(mask_value=0., input_shape=(timesteps, features))) model.add(LSTM(32))
我听说有人说掩蔽介于两者之间:
A)完全删除缺失值/行,和
B) 输入/学习缺失值
谁能解释为什么屏蔽与仅从时间序列中删除值有什么不同?到目前为止我理解的方式是:如果输入张量中的所有值都等于掩码值,则将跳过该时间步并转移状态(如果 stateful 为真)。这与从时间序列中排除行有何不同?